-
1. Re: JavaScript in a Text Field to Show/Hide a Calculated Field
George_Johnson Jul 9, 2014 1:57 PM (in response to lmphil)Assuming that's a validate script, it should work if you remove the spaces that are after the "." and before the word "display".
-
2. Re: JavaScript in a Text Field to Show/Hide a Calculated Field
lmphil Jul 9, 2014 2:24 PM (in response to George_Johnson)Thanks for the correction! I did adjust the script and doublechecked my field names, but the calculated field remains hidden after I enter text in the text box. Thanks again for your insight.
-
3. Re: JavaScript in a Text Field to Show/Hide a Calculated Field
George_Johnson Jul 9, 2014 2:49 PM (in response to lmphil)Note that the validate script doesn't get triggered until the field value actually changes, to try that to see if it starts working.
-
4. Re: JavaScript in a Text Field to Show/Hide a Calculated Field
GKaiseril Jul 9, 2014 3:37 PM (in response to lmphil)Another approach would be to modify the formatting of displayed field. When using a Percentage or Currency Symbol one cannot suppress the display of the "0.00%" or "$0.00". But if one use the Number format with no currency symbol one can suppress the "0.00" display.
Validation for Currency format:
var nDec = 2; // set the number of decimal places; // number & percent;
var sepStyle = 0; // thousand separator style; // number & percent;
var negStyle = 0; // negative style; // number only;
var currStyle =""; // always null; // number only;
var strCurrency = ""; // currency symbol; // number only;
var strCurrencyCurrency = "$"; // currency symbol; // number with currency symbol;;
var bCurrencyPrepend = false; // currency prepend; // number only;
var bPercentPrepend = false; // percentage prepend; // percent only;
console.println(event.value);
if(event.value == 0 || event.value == "") {
event.value = "";
AFNumber_Format(nDec, sepStyle, negStyle, currStyle, strCurrency, bCurrencyPrepend);
} else {
bCurrencyPrepend = true;
AFNumber_Format(nDec, sepStyle, negStyle, currStyle, strCurrencyCurrency, bCurrencyPrepend);
}
Validation for the Percentage format:
var nDec = 1; // set the number of decimal places; // number & percent;
var sepStyle = 0; // thousand separator style; // number & percent;
var negStyle = 0; // negative style; // number only;
var currStyle =""; // always null; // number only;
var strCurrency = ""; // currency symbol; // number only;var strCurrencyCurrency ="$"; // currency symbol // number with currency symbol;
var bCurrencyPrepend = false; // currency prepend; // number only;
var bPercentPrepend = false; // percentage prepend; // percent only;
if(event.value == 0 || event.value == "") {
event.value = "";
AFNumber_Format(nDec, sepStyle, negStyle, currStyle, strCurrency, bCurrencyPrepend);
} else {
AFPercent_Format(nDec, sepStyle, bPercentPrepend);
} -
5. Re: JavaScript in a Text Field to Show/Hide a Calculated Field
lmphil Jul 10, 2014 7:31 AM (in response to GKaiseril)Thanks for your help! Below is a snapshot of the form code and another of the form filled in. The code you suggested worked beautifully except for the last field (GrandTotal)
The Grand Total (bottom right corner only displays 2 digits. All of the calculated fields are formatted to none with the validation code. Each of the Total fields are calculated fields. Any idea why the Grand Total is displaying differently?
Thanks for all of your help.
-
6. Re: JavaScript in a Text Field to Show/Hide a Calculated Field
lmphil Jul 10, 2014 10:53 AM (in response to lmphil)Thanks for all of your help! After studying the fields, I realized that the issue appeared to be calculating two calculated fields. I made the Grand Total a calculation of all of the rows/columns (minus the Totals). I works just fine! Thanks again.





