Jump to content

jekillen

Members
  • Posts

    28
  • Joined

  • Last visited

Everything posted by jekillen

  1. Well, I managed to locate the code that I thought was THE code, but, Moderator, your right; it is for select/option element: //document.forms.newCollection.fieldType.options[document.forms.newCollection.fieldType.selectedIndex].value I still seem to remember getting similar syntax for radio groups. Maybe not. But I think I will bypass this issue and use click event listeners on the radios to set the hidden field value directly. Thank you for time and attention: Edit 10/11/2015 Edit + I had posted code to find selected value in select/option element but it is not working as it had written it. So I have removed it. JK
  2. I am already aware of the looping through radiogroup appoach. I had developed a more direct method where the value of the selected radio button exists in the sturcture of the object itself. But it has been several years since I came on that and it is buried somewhere. I have since written many thousands of lines of javascript since then. It looks like I might have to do some 'archeology' in my own records. I seem to remember assessing selectedIndex or some such property that represented the index of the selected element. The line of code was one line, albeit long, but bypassed the need to loop through to find it. Thanks for response JK
  3. Hello; This is the first time I have posted to this forum. I have been developing javascript and php in web related context for some time. But there is always some detail that gets solved at some point, but solution is buried in old code somewhere. I am currently trying to get javascript to set a hidden field from the selection a user makes from a set of radio buttons. I have googled around and found some reference an a clue in "current value" but that won't fly in javascript, and the actual syntax was not provided...... SO: here is some code var closeSAOOpt = function() { var opt = document.forms.script.openOpt.currentValue alert(opt) } alert in code above produces "undefined". I know one of the radios is checked. I have varified that openOpt is in fact the radio group name and that it is assigned to both radio button name values. I know the document.forms.script is defined, and that javascript won't accept spaces in variable names. So I have assumed 'current value' is currentValue in javascrip But what "undefined" is referring to is often not obvious. The funtion above is called in an eventlistener attached to a button element labeled "Done" Can I get a hand with this from someone? Thank you for time and attention.
×
×
  • Create New...