0

I am trying to execute the below JS. I have a radio button , which on click should set a property of variable RefreshMapping to child as specified in the below code. however, this doesnt seem to be working. I have set the default value of RefreshMapping to template, every time i select the radio button the value should change to child, which does not. Any help would be appreciated.

</script>
<SPAN nowrap>
<body>
<table cellpadding='0' cellspacing='0' width=''>
<tr> 
<td class='{DataValueWrite}' nowrap='nowrap' width='' align="top">

   <input <pega:include name="ClientValidation"/> type="radio" class="Radio" name="<pega:reference name="$this-name" />"  onclick="document.getElementById('RefreshMapping').value='child';document.getElementById('RefreshMapping').click();" id="<pega:reference name="$THIS-DEFINITION(pyPropertyName)" />"

                    <pega:when java="<%= tools.getProperty("SelectedProduct.ChildProd").toString().equals("child") %>"> checked 
 </pega:when>
<pega:when java="<%= tools.getProperty("SelectedProduct.PROD_LEVEL").toString().equals("5") %>">
        disabled                  
    </pega:when>

value="true"><font class = "LabelName">Child Sub-Product/ Services</font>

</td>

    </tr>
 </table> 
</body>
</SPAN>

P.S: This is in a tool called Pega PRPC, so ignore the syntax as it is specific to PEGA

Ankit
  • 129
  • 7
  • 17
  • right click -> view source and post/check the html generated, that could be helpful to debug – niksvp Feb 17 '14 at 11:07
  • ...and the problem might as well be specific to PEGA. Since you're looking for a solution to a client side issue, it'd be better to provide the exact client side HTML generated by the template. Also, please double check your JS console and, if our help is still needed, post any error messages from there. – Powerslave Feb 17 '14 at 12:18

1 Answers1

1

First, your html seems malformed, why are there body tags inside of spans.

Second, are you sure there is an html element on the page with the id 'RefreshMapping'? Verify that is the result of if you are trying to get this radio button.

Third, the value for your input is currently set to "true" via 'value="true"', to select a radio button in javascript you must set the element to checked. This will give the property specified in the name attribute the value of the inputs' value attribute. Radio buttons usually have multiple input tags to the same radiobutton group, in order to select a button in that group, you get that specific element and set it to checked via document.getElementByID("id").checked = "true";

Ryan
  • 26
  • 1