wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes Not checking the other conditions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Not checking the other conditions" Watch "Not checking the other conditions" New topic
Author

Not checking the other conditions

pankaj semwal
Ranch Hand

Joined: Oct 07, 2008
Posts: 301

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.


Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

Hi,

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



Saifuddin..
[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
pankaj semwal
Ranch Hand

Joined: Oct 07, 2008
Posts: 301
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.


Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

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

Joined: Oct 07, 2008
Posts: 301
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
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

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.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
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
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
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

Joined: Oct 07, 2008
Posts: 301
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
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Not checking the other conditions