ChiBella
asked on
Javascript getElementById for text within a placeholder?
Can anyone tell me the syntax for accessing a textbox that exists within a placeholder within a javascript function?
var iOldDispoQuantity = parseInt(document.getEleme ntById('tb OldDispoQu antity'));
var iQuantityAvai = parseInt(document.getEleme ntById('tb QuantityAv ailable')) ;
I'm getting "NaN" errors and I think it's because the two textboxes are within a placeholder (child of a masterpage).
var iOldDispoQuantity = parseInt(document.getEleme
var iQuantityAvai = parseInt(document.getEleme
I'm getting "NaN" errors and I think it's because the two textboxes are within a placeholder (child of a masterpage).
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
what about this:
var iOldDispoQuantity = parseInt(document.getEleme ntById('ct l00_Conten tPlaceHold er1_tbDisp oQuantity' ).value);
var iQuantityAvai = parseInt(document.getEleme ntById('ct l00_Conten tPlaceHold er1_tbQuan tityAvaila ble').valu e);
var iOldDispoQuantity = parseInt(document.getEleme
var iQuantityAvai = parseInt(document.getEleme
ASKER
var iOldDispoQuantity = parseInt(document.getEleme ntById('ct l00_Conten tPlaceHold er1_tbDisp oQuantity' ).Value);
var iQuantityAvai = parseInt(document.getEleme ntById('ct l00_Conten tPlaceHold er1_tbQuan tityAvaila ble').Valu e);
same thing... "NaN"
var iQuantityAvai = parseInt(document.getEleme
same thing... "NaN"
case matters
use lowercase value like i typed it, not Value
use lowercase value like i typed it, not Value
ASKER
I had the case wrong on value. It works!
Thanks again!
Thanks again!
no problemo
ASKER
I have one more problem. One of the text fields I'm pulling is not visible....so generates an error. Is there a workaround for this?
hi chibella, you should accept an answer on this question and then post a new question for the new issue.
ASKER
oh man...you are trying to become genious!
thanks chibella, did you accept the answer that helped you or just the first one? I though this one answered your question: 20113427...
This kind of defeats the purpose of EE because people will come her elooking for answers and they will look at which one you selected as the 'accepted answer'.
This kind of defeats the purpose of EE because people will come her elooking for answers and they will look at which one you selected as the 'accepted answer'.
ASKER
No I chose the right answer. The question was how to find the right syntax within a placeholder. You did assist some....so I guess you can have 50.
var disposableQuant = document.getElementById('c tl00_Conte ntPlaceHol der1_tbDis poQuantity ');
var quatAvailable = document.getElementById('c tl00_Conte ntPlaceHol der1_tbQua ntityAvail able');
var iOldDispoQuantity = (disposableQuant!=null)?pa rseInt(dis posableQua nt.value): 0;
var iQuantityAvai = (quatAvailable!=null)?pars eInt(quatA vailable.v alue):0;
var quatAvailable = document.getElementById('c
var iOldDispoQuantity = (disposableQuant!=null)?pa
var iQuantityAvai = (quatAvailable!=null)?pars
ASKER
I'd like to spread the points. How do I do that after it's closed?
no idea, probably can't
btw, i re-read your question at post 20113504 and think i was wrong to say you should open a new question for it, when i read it i thought it was unrelated (to do with ap.net control visibility) but i see it is actually a tweak to the script in question. that's why i posted 20115947.
btw, i re-read your question at post 20113504 and think i was wrong to say you should open a new question for it, when i read it i thought it was unrelated (to do with ap.net control visibility) but i see it is actually a tweak to the script in question. that's why i posted 20115947.
ASKER
var iQuantityAvai = parseInt(document.getEleme
also tried the name and get same "NaN" error.
any other suggestions?