klancicj - Monday, September 22, 2014 6:26 AM:
Hello everyone!
I have a problem getting the value of the radio input I added in a form. I have constructed the following form:
I managed to get the value from the text fields by referring to the following lines of code:
var part1 = this.form.part1.value;
var part2 = this.form.part2.value;
var partrev1 = this.form.partrev1.value;
var partrev2 = this.form.partrev2.value;
With this I can get the values from the text field, where the "Name" fields are configured as "part1", "part2", etc. Therefore I tried the same with the radio input. The name field is set to "compare_base" and when I try to get the value from the radio input, it returns null/undefined:
var radio = this.form.compare_base.value;
RESULT: Event handler failed with message: TypeError: srcElement.form.compare_base is undefined
I also looked up the generated HTML code. The radio input has a method handleItemChange("compare_base", this.value) and this method is called on select a assume. The value property itself has the right value in the HTML code and therefore should set the right value to "compare_base".
I also tried to get the value with document.getElementByName("column_base") and still no result.
I am really having trouble getting the value from the input. Is there a formal way to get it? I also tried different searches in the document to get the value - like document.getXXYY.
DavidSpackman - Monday, September 22, 2014 8:01 PM:
We use an OnChange event in the form to capture when the value changes
Here is the code we use to get the value of the radio button
var thisItem = document.thisItem;
var compare_base= thisItem.getProperty("compare_base");
Dave
klancicj - Tuesday, September 23, 2014 4:01 AM:
Great! I finally get the value!
Thanks a lot!
klancicj - Tuesday, September 23, 2014 4:02 AM:
It finally works!