I have a form with Radio buttons I want to fill based on a lookup. I figured, "What a wonderful application of Javascript this could be!" Well, I seem to be having trouble.
What I am wanting to do is take the value of the field, say Field13, and pass it 1 or more parameters that will be used to test/set the radio button.
Basically, say, I have a radio button with the options, Yes or No. I have the field above it hidden using CSS but filled by the Lookup and then have Javascript check for that hidden field to change. If the user decides to change it after that, then it won't do any harm.
The tricky part of this is I really enjoy well written code and i have these fields in a few places on the same form. I want this function in javascript to be dynamic for each and future usage.
I was figuring of using boolean values for the hidden fields and sending the parameter of the radio button field to change, but that does not work. As soon as I put quotes anywhere when calling the function in an event listener, it runs it on load.
I was thinking, hey, maybe I can pass the field number and make a string of the field name using that for when I want to set the radio button. But so far no luck. I figured I should prove that I can reference a field properly, so I tried taking the value from the field that will be autofilled and set it to another temporary field to show that i was referencing things properly.
Can someone please help me?
EDIT:
Some ideas about what I'd love to be able to pass and use when I call a function to select the radio button: (Each of the bullets is a different idea of the parameter sets I thought might be useful in combination of each other)
- The radio field number/Radio field
- The Radio Field, # of options
- The Radio Field, lookup value for option 1, option 1 value, lookup value for option 2, option 2 value
Also, currently I removed the CSS that makes the fields hidden