PDA

View Full Version : Multiple Java Scripts and Forms


EJCampbell
05-25-2003, 03:53 AM
Good day,

I have searched the Java Kit pages for help in this area. While I have found information, I am a self taught web builder and still get hung up on some of the jargon. I appreciate your consideration in assisting me with these questions.

1. I would like my form to validate certain fields (which I can do if it is very basic, like just making sure "something" is in the field.) For instance, how to make sure one field is numerical - and another field is in fact an email address.

2. How do I get 2 buttons to do 2 different things (not submit or cancel - can do that) but rather "submit" (goes to thank you page) and then "help" goes to another page.

Your web pages are very thorough - I'm just a novice really. If you would consider assisting me I would greatly appreciate it. Would I be able to send you the codes so you can see what I have done?

Sincerely,

EJCampbell

Philip M
05-25-2003, 07:39 AM
Form field validation has been very much covered in this forum - suggest you use the search facility. A good deal of this uses regular expressions which are quite advanced JavaScript. Email address validation is well defined, as you would expect.

Your second question (click on a button to go to another page):-


<SCRIPT language="JavaScript">
<!--
function goToURL() { window.location = "anotherpage.html"; }
// End -->
</SCRIPT>


<p align="center"><input type=button value="Click here to go to another page" onClick="goToURL()">

I would recommend you get a book on JavaScript. I found "JavaScript in Easy Steps" by Mike McGrath ISBN 1-874029-89-X very helpful and clearly written.