Client Side Things
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesClient Side Things

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old March 11th, 2005, 03:18 PM
lmayer lmayer is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: USA
Posts: 225 lmayer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
OnChange Versus OnSubmit

Morning,

I have a very large form that uses an external js page for validation. That works fine. But I also have these fields that have functions attached. The one I wrote to check the value of another field works fine if you use form onSubmit. However if you try to attach it to a field with the OnChange function it breaks.


<!-- Begin function
function Form_Validator(testform)
{
if ((testform.InternetAccess.value != "") && (testform.VPEmail.value == ""))
{
alert("Please enter your VP's email address.");
return false;
}
return (true);
}

<!--Field

<select name="InternetAccess" size="1" onChange="Form_Validator(this)">
<option selected> </option>
<option value="Internet Access">Internet Access</option>
<option value="Internet Access Enhanced">Internet Access Enhanced</option>
<option value="Intellitrader">Intellitrader</option>
</select>

Any thoughts would be appreciated.

Thanks

Laura

Reply With Quote
  #2  
Old March 11th, 2005, 05:18 PM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
RE: OnChange Versus OnSubmit

I assume that when you are using it for onSubmit, you are calling the function from the <form> tag. When you use "this" as an argument for the function, "this" sends a reference to the element that the function is being called from. Since your validation expects that argument to be a reference to the form, when you use it in your select box, it is sending a reference to the select box, not the form. all you need to do is change the argument so it references the form...like so.

<select name="InternetAccess" size="1" onChange="Form_Validator(this.form)">

this will send a reference to the form instead of a reference to the select box which should solve your problem.

Reply With Quote
  #3  
Old March 11th, 2005, 05:30 PM
lmayer lmayer is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: USA
Posts: 225 lmayer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: OnChange Versus OnSubmit

Wow. Thanks for that I was just about to post that I had figured it out. I did that by finding another example not necessarily becasue I knew what I was doing. Thanks for explaining.
Laura

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesClient Side Things > OnChange Versus OnSubmit


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway