By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,442 Members | 1,316 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,442 IT Pros & Developers. It's quick & easy.

Code not going to JS Validation

P: 3
Hi there,

I have written a registration form with the following code which takes it to a separate JavaScript validation page:

Expand|Select|Wrap|Line Numbers
  1. <script type = "text/javascript" src = "testnewadministratoruser.js">
  2.  
  3. </script>
  4.  
I know this is right, however it 's still not catching it. I've shown the code to a couple of Professors at my university and they cant work it out! Any suggestions/thoughts on the matter would be gratefully appreciated!
Jul 27 '07 #1
Share this Question
Share on Google+
5 Replies


pbmods
Expert 5K+
P: 5,821
Heya, Gillian1985. Welcome to TSDN!

What do you want your code to do? Give an example.
What is your code doing that you don't want it to do? Give an example.
What is your code *not* doing that it is supposed to? Give an example.
Jul 27 '07 #2

P: 3
Hi There!

The validation script checks each field and makes sure that the appropriate value has been entered, an error message should appear where each field has been left empty. However even if I leave all the fields empty it adds a blank record to my database. Infuriatingly i've used the exact approach in another part of my site and the JS validation works perfectly! I've checked them both thorougly and the code is the same. Even my professor has no idea whats going on with it!
Jul 27 '07 #3

ak1dnar
Expert 100+
P: 1,584
I think this is the thing you have to do. to call for a JS script in the same directory.

src="your_jsfile.js" // set the path here

your_jsfile.js

Expand|Select|Wrap|Line Numbers
  1.  function dosomething(){
  2. alert("boom")
  3. }

Html
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script language="JavaScript" type="text/javascript" src="your_jsfile.js"></script>
  4. </head>
  5. <body>
  6. <input name="call_js" type="button" value="try it" onclick="dosomething()" />
  7. </body>
  8. </html>
  9.  
Jul 27 '07 #4

P: 3
Hi there,

Thanks for your help, amaged to get the script working over the weekend. Will definately keeep using this site.

Gillian
Jul 30 '07 #5

ak1dnar
Expert 100+
P: 1,584
Hi there,

Thanks for your help, amaged to get the script working over the weekend. Will definately keeep using this site.

Gillian
glad to hear that Gillian, welcome back any time to TSDN.
-ajaxrand
Jul 30 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.