Print Page | Close Window

Check form value onload

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Web Design Discussion
Forum Description: Discussion on web design and development subjects.
URL: https://forums.webwiz.net/forum_posts.asp?TID=29451
Printed Date: 28 March 2026 at 9:08am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Check form value onload
Posted By: dwhite02
Subject: Check form value onload
Date Posted: 24 June 2011 at 4:36am

Hi Everyone,

Quick JavaScript question.

I have a form which has two submit buttons, with either one hidden dependant on the value of a form field (radio button), this works fine when switching between the radio button values but I also want the function to fire onload when the form is reloaded, which occurrs when a user comes back to this page/form from another page/form. The reatining of the field value is working fine, just having some problems with the onload bit.

Code so far:
--------------
//Javascript used (and works)for onclick of radio buttons

function SetButtonLabelGSTCopy2(obj)
{
if(obj.value == "Yes")
{
document.getElementById("GSTButton").className="hidden";
document.getElementById("SubmitButton").className="show";

} else if (obj.value == "No")
{
document.getElementById("GSTButton").className="show";
document.getElementById("SubmitButton").className="hidden";

}
}

--------------

html

<input type="radio" name="Q2B6" value="Yes" id="Q2B6" onclick="SetButtonLabelGSTCopy2(this);"  />
<input type="radio" name="Q2B6" value="No" id="Q2B6" onclick="SetButtonLabelGSTCopy2(this);"  />

<input name="GSTButton" type="submit" id="GSTButton" onclick="diary.action='copyright_gst.asp'; return true;" value="Go to Confirmation of GST Treatment Form">
<input name="SubmitButton" type="submit" id="SubmitButton" onclick="diary.action='copyright_send.asp'; return true;" value="Submit Copyright Licence Request Order Form">

----------------


How can I fire this check onload as well?

Thanks




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net