Yes, dwarfthrower, you are correct, my mistake.
I was so focused on your second js code, I passed over the onclick code you included.
Then I read the FAQ at:
http://www.tek-tips.com/faqs.cfm?fid=2809
but not carefully enough, and wrongly assumed that this.form was not needed.
Your code...
onclick="return validateMyForm();"
function validateMyForm(objForm){
// Initialise an error message
var strError = "";
// Build up the error message with your
// functions
strError += function_1(objForm);
strError += function_2(objForm);
// If we have no error message then
//...
dwarfthrower,
Before coming to this forum, I did spend many hours Google-searching trying various search terms and finally gave up because I could not find anything that worked.
Your second solution would be best but The Error Console says that objForm has no properties.
...
function...
It's not a matter of time, it's a matter of knowledge.
I was aware of the Firefox Error Console and was using that, but you indicate that I should use a "debugger" also.
I have now installed the Venkman debugger and will try that.
Thank you for the information.
The return statement specifies the value to be returned by a function and performs the act of returning that value to where the function was called from.
Tried the following, does not work:
function function_1(health)
{
if(health.phone.value=="")
{
alert("Please enter your home telephone...
In javascript, I am trying to call more than one function starting with onclick in a form.
In the form, this does not work:
<input type="submit" value="thevalue" name="goodname" onclick="return function_1(this.form);function_2(this.form);" />
So I tried only function_1 for the onclick, and...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.