Highlighted

Previous Value of Radio button

Avatar

Guest

12-02-2009

Is there a way similar to how Dropdown lists work that I can obtain the previous value of a Radio button selection?



Thanks,

Replies

Highlighted

Niall_O_Donovan

12-02-2009

Hi,<br /><br />I got the following Javacsript from the forum a while back.<br /><br />This section was in the mouseDown event:<br /><br />// Capture initial value of radio Button and save it as a member of the radio button object<br />this.initValue = this.rawValue;<br /><br />Then the following Javascript in the mouseUp event:<br /><br />// Test the captured intial value and set the radio button to<br />// off only if the initial value of the radio group is <br />// the same as the export value for this radio button<br />var localExport = null;<br />for(var i=0;i<this.nodes.length;i++)<br />{<br /> if(this.nodes.item(i).className == "items")<br /> {<br /> localExport = this.nodes.item(i).nodes.item(0).value;<br /> break;<br /> }<br />}<br /><br />if(this.initValue == localExport )<br /> this.rawValue = 0;<br /><br />I am not sure if this is what you want, but it allows the user to deselect a radio button. Both scripts need to be in all of the radio buttons in a group.<br /><br />Good luck,<br /><br />Niall