Forum
Calc Builder Support
Calc Builder supportForums
Public write access is disabled. Please login
Re: Set default value 03.09.2014 20:34
Hi,
in order to set field values dynamically you must use javascript section to capture the event of the first field changing and assign a new value to the destination field, this code should be placed at the first js tab of your calculator, replacing yourfirstfieldname and yoursecondfieldname with the right field names at your form:
CB("input[fldname=yourfirstfieldname]").change(function(){
var newvalue=CB("input[fldname=yourfirstfieldname]").val();
CB("input[fldname=yoursecondfieldname]").val(newvalue);
});
Hope this helps, regards
Moonsoft Team
www.moonsoft.es
in order to set field values dynamically you must use javascript section to capture the event of the first field changing and assign a new value to the destination field, this code should be placed at the first js tab of your calculator, replacing yourfirstfieldname and yoursecondfieldname with the right field names at your form:
CB("input[fldname=yourfirstfieldname]").change(function(){
var newvalue=CB("input[fldname=yourfirstfieldname]").val();
CB("input[fldname=yoursecondfieldname]").val(newvalue);
});
Hope this helps, regards
Moonsoft Team
www.moonsoft.es
Re: Set default value 17.11.2015 10:52
Hi,
that is more complex, as you can't capture the event of the inline result being changed, because it's done internally by the calculator script. As a workaround, you can use other field change event, wait sometime until the inline field has the new value and then use it. The structure would be:
CB("input[fldname=yourfirstfieldname]").change(function(){
setTimeout(function(){
var newvalue=CB("div[fldname=yourinlinefieldname]").html();
CB("input[fldname=yoursecondfieldname]").val(newvalue);
}, 3000);
});
replacing
yourfirstfieldname
yourinlinefieldname
yoursecondfieldname
with your calculator fields. You can create more sections with the same structure and other 'yourfirstfieldname' in order to attach it to more input fields.
This is not an optimal solution as you're waiting 3sg for the result, you must ensure this is enough for the calculator returning the proper value to the inline, you should increase this time if required.
Hope this helps, regards
Edited by MSTeam - 18.11.2015 18:54
Moonsoft Team
www.moonsoft.es
that is more complex, as you can't capture the event of the inline result being changed, because it's done internally by the calculator script. As a workaround, you can use other field change event, wait sometime until the inline field has the new value and then use it. The structure would be:
CB("input[fldname=yourfirstfieldname]").change(function(){
setTimeout(function(){
var newvalue=CB("div[fldname=yourinlinefieldname]").html();
CB("input[fldname=yoursecondfieldname]").val(newvalue);
}, 3000);
});
replacing
yourfirstfieldname
yourinlinefieldname
yoursecondfieldname
with your calculator fields. You can create more sections with the same structure and other 'yourfirstfieldname' in order to attach it to more input fields.
This is not an optimal solution as you're waiting 3sg for the result, you must ensure this is enough for the calculator returning the proper value to the inline, you should increase this time if required.
Hope this helps, regards
Edited by MSTeam - 18.11.2015 18:54
Moonsoft Team
www.moonsoft.es