change button label
Hi
I would like to insert a function in the validation script of a field called "age" that allows me to change the label of a button called "Button5"
I tried to build this function
if(event.value>45){var s1=75-event.value;this.getField("Button5").buttonSetCaption(this.getField("Button5").buttonGetCaption()+s1);}
else{var s1=30;this.getField("Button5").buttonSetCaption(this.getField("Button5").buttonGetCaption()+"30");}
This feature works well when the button label is blank. The problem arises when there is already a number in the button label.
In fact, if the button label is empty and I enter the number 50 in the "age" field, the number 25 appears in the button label.
If I subsequently change the number in the "age" field and enter, for example, the number 40, 2530 appears in the button label and not 30 as I would like.
Please, can anyone help me solve this problem?
Thank you
