• 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

Not checking the other conditions

 
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi,

This my java script code.But this code show only document.getElementById(id).value =SP;
value in my jsp page.After that it does not check other conditions.
Pleas help me what the problem, in this code.


 
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Didn't get what you are really want to achieve.. would you please make simpler.


 
pankaj semwal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
This is my code sample on the change event of
<input type="text" name="workorder.unitRate" value="" id="unitRate" onchange="putvalue();"/>

the values in these text boxes are not populating.

input type="text" name="statId0" value="" id="workorderlist_statId0"/>
input type="text" name="statId0" value="" id="workorderlist_statId0"/>
input type="text" name="statId0" value="" id="workorderlist_statId0"/>
input type="text" name="statId0" value="" id="workorderlist_statId0"/>

Please help me.


 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

pankaj semwal wrote:
This my java script code.But this code show only document.getElementById(id).value =SP;
value in my jsp page.After that it does not check other conditions.



That's normal for if-else statements. Once the test value in an if-clause is true, then its associated statement (in your case document.getElementById(id).value =SP) is executed and the else-clause is not executed. Since those "other conditions" are in the else-clause, they don't get executed.
 
pankaj semwal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
Then what i have to made the change in the function so that the values of the other text boxes should print.

Thanks
 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I didn't see any text boxes in your original post. Your follow-up, which was supposed to "simplify" the question, was way too long to read. It would help if you could come up with a small example and a question about that example.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HTML Specs says IDs have to be singular so your code is invalid so getElementById will fail.

edit[I think you had copy/paste error with your subset of code. ]

Eric

 
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
The JavaScript error is

TypeError: document.getElementById("record").rows[i].cells[1] is undefined

JavaScript 101 debugging should give you more info, add a debugging statement in your loop:



Eric
 
pankaj semwal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am not understanding this "HTML Specs says IDs have to be singular so your code is invalid so getElementById will fail. "

Can you explain this.


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

pankaj semwal wrote:Hi,
I am not understanding this "HTML Specs says IDs have to be singular so your code is invalid so getElementById will fail. "

Can you explain this.


Thanks



When you typed up your question you copy and pasted id="workorderlist_statId0 a bunch of times and never changed it. Hence why I thought you used the same ID 5 times.

Eric
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic