| | |
Return value based upon visibility of form field?
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Nov 2008
Posts: 8
Reputation:
Solved Threads: 0
Thank you Essential and Drew for your suggestions.
I have a couple more questions for both of you.
Drew,
Thanks again!
I understand that your coding below would return a value of T/F on the checkbox:
What I'd like to figure out still is the following:
1) checkbox returns value of T/F
2) checkbox triggers an event as follows
This code currently activates the "No" Checkbox and sets the TotalField to 0.00
This code fails to return the product (a*b) into the TotalField when the "Yes" checkbox is True:
Essential,
Thanks so much for your generous consideration! However, at this point, the code you've included, appears to have the same issue I've been facing, namely the value generated by the calculation continues to appear in the total field whether or not the Field Value is hidden. Because I need to add up the selected totals of my client, this behavior results in an incorrect total.
Any further thoughts??
Thanks much for all your time!!
Best,
TrinityAvatar
I have a couple more questions for both of you.
Drew,
Thanks again!
I understand that your coding below would return a value of T/F on the checkbox:
•
•
•
•
document.FromName.checkBoxName.checked
1) checkbox returns value of T/F
2) checkbox triggers an event as follows
• if True: return product (a*b) into TotalField
• if False: delete contents of TotalFieldI've been able to reset contents of TotalField to 0.00 but when I attempt to return the product (a*b) to TotalField, it remains 0.00.
This code currently activates the "No" Checkbox and sets the TotalField to 0.00
•
•
•
•
var CollectionTotal = this.getField("CollectionTotal")
function resetField(name,value)
{
CollectionTotal.value = value;}
if (event.target.value == "No")
{
CollectionTotal.hidden = true
&& resetField('CollectionTotal','0.00')
}
else {
CollectionTotal.hidden = false
}
•
•
•
•
var CollectionTotal = this.getField("CollectionTotal")
function product(a,b)
{
return a*b;
}
if (event.target.value == "Yes")
{
CollectionTotal.hidden = false
&& document.write(product("CollectRate*NumPosters"))
}
else {
CollectionTotal.hidden = true
}
Essential,
Thanks so much for your generous consideration! However, at this point, the code you've included, appears to have the same issue I've been facing, namely the value generated by the calculation continues to appear in the total field whether or not the Field Value is hidden. Because I need to add up the selected totals of my client, this behavior results in an incorrect total.
Any further thoughts??
Thanks much for all your time!!
Best,
TrinityAvatar
![]() |
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: .js references from content to master don't work
- Next Thread: Javascript for changing image every 2 seconds
| Thread Tools | Search this Thread |
Tag cloud for JavaScript / DHTML / AJAX
acid2 ajax ajaxexample ajaxjspservlets array blackjack browser captcha captchaformproblem cart child class close codes date debugger dependent developer disablefirebug dom editor element embed engine enter events explorer ext file firefox flash focus form forms frameworks game getselection google gxt hiddenvalue highlightedword hint html ie7 ie8 iframe java javascript javascripthelp2020 javascripts jquery jsf jsp jump libcurl listbox maps marquee masterpage math media menu object onerror onmouseoutdivproblem onmouseover onreadystatechange parent passing paypal pdf php position post programming prototype rated redirect safari scale scriptlets scroll search security size software sources star starrating stars stretch synchronous toggle tweet unicode variables web webservice window \n





