Page 1 of 1

alert box popup from form onsubmit

Posted: Tue Jan 29, 2008 8:40 am
by edzillion
I am trying to replicate the functionality of a form on a webpage, and I need some help.

Code: Select all

 <form id="form1" onsubmit="return validateFormOnSubmit(this)" 
 name="updates" method="post" action="market_update_FV.php">
When the form is submitted with incorrect data an alert box is popped up in the browser window:

Image

How do you do this?
Also, is validateFormOnSubmit() a php function? I didn't know that a function could be called in the file in the action= field...

TIA
Ed

Re: alert box popup from form onsubmit

Posted: Tue Jan 29, 2008 9:51 am
by yacahuma
no, that is a javascript function.

in you validate you will use alert()

Re: alert box popup from form onsubmit

Posted: Tue Jan 29, 2008 11:37 am
by edzillion
thanks
Also, the 'this' pointer in validateFormOnSubmit(this), what type is it?
How to deal with this in the javscript function declaration?

Ed

Re: alert box popup from form onsubmit

Posted: Tue Jan 29, 2008 9:04 pm
by yacahuma