kfiralfia
07-31-2005, 08:29 PM
I'm using an image for the submit button in a form, like this:
<input name="submitbutton" type="image" id="submitbutton" width="110" src="/Images/submit_button.gif" onclick="this.src='/Images/please_wait.gif'" height="25" />
In the <form> tag, I call a javascript that checks my form fields, like this:
<form name="account_update" action="index.cfm?" method="post" onsubmit="return CheckPersonalInfoForm();">
And in this javascript function CheckPersonalInfoForm(), one of the lines of code is:
document.forms[0].submitbutton.src = '/Images/submit_button.gif';
The reason I'm doing this is so that when the user clicks on the graphic submit button, the submit button graphic changes to one that says "please wait", then upon submit a javascript function is called that checks the fields. If there's no error, the user sees the button "please wait" until the form is submitted and the page is refreshed. If there is an error, the user sees an "alert" box with a list of errors they need to fix in the form.
It is at this point that I want to change the submit button graphic back to the original graphic "submit_button.gif".
However, my Firefox javascript debug console gives me the error:
"Error: document.forms[0].submitbutton has no properties"
And the image stays the same (stays being "please_wait.gif'")
Any ideas why this is happening?
<input name="submitbutton" type="image" id="submitbutton" width="110" src="/Images/submit_button.gif" onclick="this.src='/Images/please_wait.gif'" height="25" />
In the <form> tag, I call a javascript that checks my form fields, like this:
<form name="account_update" action="index.cfm?" method="post" onsubmit="return CheckPersonalInfoForm();">
And in this javascript function CheckPersonalInfoForm(), one of the lines of code is:
document.forms[0].submitbutton.src = '/Images/submit_button.gif';
The reason I'm doing this is so that when the user clicks on the graphic submit button, the submit button graphic changes to one that says "please wait", then upon submit a javascript function is called that checks the fields. If there's no error, the user sees the button "please wait" until the form is submitted and the page is refreshed. If there is an error, the user sees an "alert" box with a list of errors they need to fix in the form.
It is at this point that I want to change the submit button graphic back to the original graphic "submit_button.gif".
However, my Firefox javascript debug console gives me the error:
"Error: document.forms[0].submitbutton has no properties"
And the image stays the same (stays being "please_wait.gif'")
Any ideas why this is happening?