Page 1 of 1

how can i validate a form designed in php using javascript

Posted: Thu Feb 19, 2004 10:40 pm
by softsolvers
hello friends
i like to validate a form designed in php and html with java script.
i had used the image to link on the other page.
snap shot of the code i am using::
echo"<form method=POST action=frmdisplay.php>";
echo"<input type=text name=txtname size=30>";
echo"<a href=frmdisplay.php><image src='test.jpg'></a>";
echo"</form>";


now i like to validate the text box that if it is not filled the n it should prompt what should i do.
plz send me the code to do this.
i also like to ask that can i use the value passed in the javascript func. in the php in the same page

Posted: Fri Feb 20, 2004 12:43 am
by Pointybeard
well php just renders a page for display, the javascript would still execute normally in the final page. All you gotta do is place the javascript in as per normal. Theres heaps of tuts around for that sort of thing. Try googling. ;)

Form Validation Javascript

took me 2 sections.

-PB

Posted: Sat Feb 21, 2004 4:50 am
by softsolvers
i am a bit specific i am showing you the code from where i want to call the validation function
i am taking :
<input type=image src="path" onclick="call function">
now each time itr is returning to the true value while i am wanting that iff the field is not filled then it should stay on the same page

Posted: Sat Feb 21, 2004 6:14 am
by Pointybeard
Did you even look at the google search results? i found at least 4 or so sites that answer your problem. ~:/