943,548 Members | Top Members by Rank

Ad:
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Nov 20th, 2008
0

Re: Return value based upon visibility of form field?

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:
Quote ...
document.FromName.checkBoxName.checked
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
• if True: return product (a*b) into TotalField
• if False: delete contents of TotalField
I'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

Quote ...
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
}
This code fails to return the product (a*b) into the TotalField when the "Yes" checkbox is True:

Quote ...
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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
trinityavatar is offline Offline
8 posts
since Nov 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: .js references from content to master don't work
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: Javascript for changing image every 2 seconds





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC