call JavaScript function from asp


J

Joe T

I am using Access database, ASP, and some Javascript.
A Group of two radio buttons.
Button "noshow" updates a record and calls a javascript function. The
javascript function puts a value in a hiddenfield.
Button "show" updates the same record and places a different value in
the same hiddenfield without using the javascript function.

<label>
<input name="RadioGroupA" type="radio" id="noshow"
value="&lt;!--" <% If Recordset2("image_code_A")="<!--" Then %> checked
<% End if %> onclick="doItA(this);"/>
noshow</label>
<br />
<label>
<input name="RadioGroupA" type="radio" id="show" <% If
Recordset2("image_code_A")="" Then %> checked <% End if %>
onclick="document.getElementById('hiddenFieldNo').value=" value="""/>
show</label>

javascript function:
function doItA(obj){
obj.form.elements['hiddenFieldNo'].value = "-->";
}

When either button is clicked and then Submit, the database gets updated
with the new values and the asp page returns displaying the checked
radio button.
When noshow button is clicked, and submitted, it works fine. The problem
is, when the asp page returns, if the Submit button is clicked again,
the javascript function does not get called even though the noshow
button displays "checked". Even though the noshow button displays
"checked" I would have to click the noshow button again, and then hit
Submit for the page to call the javascript function.
Is there a way to have the previously checked noshow radio button work
without having to click it again and work by just Submit the page?
 
Ad

Advertisements


Top