| | |
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 |
ajax ajaxcode ajaxexample ajaxhelp ajaxjspservlets animate automatically beta box browser bug calendar captchaformproblem checkbox child class close column createrange() css cursor date debugger dependent disablefirebug dom download dropdown editor element embed engine error events explorer ext file form forms getselection google gwt gxt hiddenvalue highlightedword hint html htmlform ie7 ie8 iframe images internet java javascript javascripthelp2020 jawascriptruntimeerror jquery jsf jsfile jump libcurl math media microsoft mimic object onmouseoutdivproblem onreadystatechange parent paypal pdf php player position post problem programming progressbar regex runtime scroll search security select shopping size software sql text textarea unicode w3c web website window windowofwords windowsxp wysiwyg \n





