- dleflangAsked on January 23, 2012 at 01:16 AM
I have 3 different types of calculations:
1) Add (x+ field value), also to display in form
2) Add numerical field value to another numerical field value, also display in form
3) Conditional threshold:
If A + B > 10, prepop field C with "High"
If A + B < 10, prepop field C with "low"
are these possible?
I assume the souce code will need to be edited and uploaded?
Could you please suggst how the to go about the code?
- fxrAnswered on January 23, 2012 at 07:23 AM
Yeah, you would need to upload source code again.
I will summarise your desired calcs below
Field + number :-> Add Number
Field1 + Field 2 :-> Add fields
is field1 + field2 > of < Number (10) :-> added fields higher or lower than number
- dleflangAnswered on January 23, 2012 at 07:31 PMReusability would be nice, but for now let’s just see if it can work:
Also, the first 2 summaries you have correctly.
The last one, you may have it right, I am not sure. Here is how I would state it:
Field1 + Field 2 :-> Add fields, if sum is greater than x, then show y in field 3. If sum is less than x, then show z in field 3.
- fxrAnswered on January 23, 2012 at 07:37 PM
OK, Dave I will have a go at that tomorrow.
I don't envisage too many problems.
Thanks for the clarification on the 3rd one, the aim of that summarising was to try and arrive at 'nicknames' for each calc so we quickly knew which one any of us was refering if we needed to talk about it. Also felt it would aid in any comments/variable names etc in any code that could be reused.
Anyway, you should see something back from me at some point tomorrow.
- dleflangAnswered on January 23, 2012 at 07:44 PMThanks!
- fxrAnswered on January 24, 2012 at 05:42 AM
OK, heres the script that will make those calcs work on that form:
Add that just before your closing </body> tag.
I have tried to make the code as reusable as possible; you just need to update the relevant variables names with any new element IDs for a particular field.
Test webpage/form is here
Let me know if you have any questions on that.