HTML, JavaScript And CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingHTML, JavaScript And CSS Help

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 ASP Free Forums Sponsor:
  #1  
Old April 1st, 2004, 07:25 AM
adam2719 adam2719 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 5 adam2719 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Javascript looping through dynamic forms

Please can someone help out with this? To reiterate, I am looking for a script that will accept an ASP variable for the number of text items on in the form (as this is done dynamically). Then I wish to total the elements (be it 5 or 50) and alert if it is over a specific total, say 100.

It would be something like...Onsubmit the following function would fire:

Loop through all form elements (there will only be text boxes called text<%=n%>)
If form.elements.total > 50
Alert ("you have exceeded your limit, please amend your data")

Hope that helps

Thanks

Reply With Quote
  #2  
Old April 1st, 2004, 09:37 AM
spungebob spungebob is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: Dover
Posts: 128 spungebob User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 39 sec
Reputation Power: 5
ASP sample after onsubmit returns you to the same form

For x = 1 to Request.Form("Catalogid").Count
If val(Request.Form("qty_Ordered")(x)) > 0 then
Mfound = true
end if
next


You can add up your fields values and then when your html redisplays you could show a message that your over 100?

Hope this help!

Bob@lyrex.com

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingHTML, JavaScript And CSS Help > Javascript looping through dynamic forms


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