Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Check form value onload
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Topic ClosedCheck form value onload

 Post Reply Post Reply
Author
dwhite02 View Drop Down
Newbie
Newbie


Joined: 10 October 2004
Status: Offline
Points: 33
Direct Link To This Post Topic: Check form value onload
    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

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.