• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

plz help me...

 
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, I am confused on how to do this..!!!
So i thought i'll ask the Experts here...
In one of my JSP page(s) I generate a table like this:

Now As far as Javascripting is concerned, How do I get the names of the Input Fields.. like 0,1,2.... in the Javascript(JS)
because all these input fileds have Time Values, which I have to check whether they are in the right format, before allowing Submission...
Previously I did something like this:
// time format checking
if(f.one.value != ""){
if(!IsValidTime(f.one.value))
{
f.one.focus()
return false
}
}
In this case I knew that "one" is the name of the Input filed..
How do i do this in javascript.. because I dont know the number of input fields I might have in every occasion...
Any other ideas, are also greatly Appreciated :-)
Thanks a lot for your time & Help
cheers
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Javascript has a form element array that you can find out how many form elements exsist on the page. I can give you a more specfic answer tom.
Eric
 
Jack Daniel
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot, Eric
I am looking forward to hear your more specific answer....
I have no idea about the " form element array "
Later...
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
You can do one thing in this case. when you are giving names for input fields in for loop just add some character infront of the 0,1,2.. something like this.
<input name=abc "your increment value for ps">
so your fields will be having names like abc0, abc1, abc2, abc3...
while you write JS you can simillarly call this values.
I hope you will get some idea.
 
Jack Daniel
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Thanks for that..
but how do I know the # of Input Fields...??
abc0,abc1,........ where to stop
Anyway I canot extract anything from session in client-side JS.
So,..
i'll giv a try... if you can help me with other ideas, it would be Great..
ur previous idea was also good..
Thanks
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Basic idea of what I said before
TheForm=document.forms[0].elements;
for(i=0;i<TheForm.length;i++){
YourValue=TheForm.value;
}
 
reply
    Bookmark Topic Watch Topic
  • New Topic