- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2016 02:54 PM
I've created a form using a UI Page and would like some of the fields to dynamically change depending on what is entered in other fields. For example if a user fills out field A with $100,000 and field B with $25,000, is it possible for field C to dynamically change to $125,000 (A+B) without submitting or reloading the page? Would that be a client or processing script?
Thanks!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2016 12:42 PM
You do not need onChange client script declaration. Remove everything from the client script section and just copy this
function sum(){
$('H').value=parseFloat($('D').value)+parseFloat($('G').value);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2016 01:55 PM
hey Abhinay, one more follow up question. Can I have multiple onchange functions on a UI page or can there only be one?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2016 01:57 PM
You mean multiple onChange events for a single html element?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2016 02:00 PM
I mean multiple onChange events for the same UI Page, but on different elements. For instance I have the sum() above, can I have another that subtracts fields and another that multiplies fields, etc.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2016 02:02 PM
Yes you can. Create an onChange events to those elements and define the functions in the client script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2016 02:23 PM
Hmm, so I created a second onchange event called deduct_3() (which I'm pretty sure the code is wrong), but it seems to render the sum() function unusable :
function sum(){
$('H').value= parseFloat($('A').value)+parseFloat($('B').value)+ parseFloat($('C').value)+parseFloat($('D').value)+ parseFloat($('E').value)+parseFloat($('F').value)+ parseFloat($('G').value);
}
function deduct_3(){
var c = parseFloat($('deductions_adjustments_1').value) - parseFloat($('deductions_adjustments_2').value);
if (parseFloat(c) <= 0) {
$('deductions_adjustments_3').value = 0;
}
else {
$('deductions_adjustments_3').value =c;
}
}
With the deduct_3() function in there, the function sum() stops working, any thoughts?
Thanks!