Question

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

Was it helpful?

Solution

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";

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top