R2i DotNetNuke® Forum

R2i wants you to have the opportunity to ask questions, post reviews, help others or just rant and rave about DotNetNuke® or any of the R2i Modules and Skins. Our team spends hour upon hour, day after day, working on custom DotNetNuke® modules and services; please feel free to ask us anything.
 
Trying to get MATH to update form
Last Post 11 Mar 2009 05:38 PM by svedire. 1 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages Informative
rdsidanUser is Offline
New Member
New Member
Posts:9

--
07 Jan 2009 04:47 PM  
I'm trying to create a form that has two numeric input fields (say FieldA and FieldB).

What I want to do is have the sum of FieldA and FieldB displayed on the same form after the user enters the values. I've been playing with the MATH tag, but can't seem to figure out how to automatically display the updated value on the form.

Any suggestions?
svedireUser is Offline
Basic Member
Basic Member
Posts:128

--
11 Mar 2009 05:38 PM  
Hi,

Try doing it the following way.

Do an lxFetch on the onblur event of the second input field that way you have values from both the input fields and then in your actions do a MATH that calculates the sum.

For ex:
<input type="text" name="field1" id="field1" value="[field1,F]" />
<input type="text" name="field2" id="field2" value="[field2,F]" onblur="lxFetch('[MODULEID<SYSTEM]',0,'flag=Calc');"/>

In your actions:
#If '[flag,Q]'='Calc'
##Assignment Action Name Calculate: {MATH,([field1,F]+[field2,F])}

## - child of 'If' action

You can access the calculated value as [Calculate,Action]

Hope this helps.

Thanks,
Sindura
R2integrated
You are not authorized to post a reply.

Active Forums 4.1
 

New York, NY • Baltimore, MD • Vienna, VA • St. Louis, MO • Seatle, WA • 410.327.0007 • info@R2Integrated.com

Bookmark & Share Bookmark and Share