Hi there. I got a dozen textfields and datetimefields in a pdf fillable form create by livecycle designer. All textfields and datetimefields have the default values. I got some javascripts to toggle checkbox to the effect that when checkbox is checked, the default value in the textfield will be cleared and let user to enter the new value; and when it is unchecked, the default value will be restored in the textfield.
if (this.rawValue == "1") {
oTargetField = this.resolveNode("DateTimeField1");
oTargetField.access = "open";
oTargetField = this.resolveNode("TextField1");
oTargetField.access = "open";
this.resolveNode("TextField1").rawValue = null;
this.resolveNode("DateTimeField1").rawValue = '';
xfa.host.setFocus("TextField1");
}
if (this.rawValue == "0") {
this.resolveNode("TextField1").rawValue = defaultValue; }
But, the script does not work when I uncheck the checkbox. Any advice, please?
Views
Replies
Total Likes
Hi,
In which event of the CheckBox you have put the script? If it is in click event then try it in the change event of the checkbox.
Thanks.
Bibhu.
Views
Replies
Total Likes
Hi there. Thanks. In fact, the event is a "change" evant. Any advice, please?
Views
Replies
Total Likes
Hi,
Could you please post the form so that I can have a look ? By the way the example you have shown here is for TextField or Datefield ?
Thanks.
Bibhu.
Views
Replies
Total Likes
is this the exact code that you are using to
set the textfield value to default
this.resolveNode("TextField1").rawValue = defaultValue ??
--
Chalukya
Views
Replies
Total Likes
Hi Chalukya,
I guess the defaultValue here means the exact value he wants to show ??
Thanks.
Bibhu.
Views
Replies
Total Likes
hmm ...if that is the case then pls share ur XDP/PDF....
--
Regards,
Chalukya
Views
Replies
Total Likes
Can anyone please tell me how to upload my pdf to this forum?
Views
Replies
Total Likes
Views
Replies
Total Likes
Hi chalukya,
I've just e-mailed the pdf form to you. Thanks. My prior script should be used to reset both the textfield and datetimefield to their original default values.
Views
Replies
Total Likes
Hey Raymond,
u cannot use this -
this.resolveNode("TextField1").rawValue = defaultValue; //if field value = empty, then restore the default
to restore the default value of TextField1.
Assign the default value to it like ..
this.resolveNode("TextField1").rawValue = "YourDefaultValue";
defaultValue object properties is not supported in Designer ES2 support/JavaScript-equivalent in Designer ES2.
You can refer to Adobe LiveCycle Designer Help for more details.
Hope this Helps!!!!
--
Chalukya
Views
Replies
Total Likes
Hi chalukya. Thanks for your advice. To repeat the default values in scripts is quite a tedius work indeed. Anyway, thanks. I got another problem regarding preventing checkbox from being a printable object. I've issued a thread but still I cannot solve the problem. I should be most grateful if you could take a look at my problem and see if there is a work around for that. Thanks in advance.
Views
Replies
Total Likes
Have you tried using xfa.host.resetData("fieldName") ...this command will reset the field to its original state. You can pass multiple fields into the command separated by commas.
Paul
Views
Replies
Total Likes
Hi there. It seems it only works for resetting all the fields in the form. What I want is when a checkbox1 is unchecked, the value of the textfield1 will be restored to its original default value defined in the object property. Any modification to the effect of that?
Cheers.
Views
Replies
Total Likes
If you do not pass in fieldnames to the resetData method then all fields will be reset. It is a string of names that you are passing so make sure that the string is in quotes. Tried it with one field on my machine and it works fine here.
Paul
Views
Replies
Total Likes
Hi Paul, thanks for the prompt reply. Here is my script and when I uncheck checkbox1, textfield1[0] and the newly entered value in textfield1[1] will be reset to their original default values instead of textfield1[0] only. Did I miss something?
Thanks.
if (this.rawValue == "0") {
xfa.host.resetData("TextField1[0]"); }
Views
Replies
Total Likes
I think you will need the whole som expression to determine which field. If it cannot find the field then the whole form is reset. So in my case the command is xfa.host.resetData("form1.Page1.TextField1[0]")
Paul
Views
Replies
Total Likes
Hi Paul. Thanks. It works after I defined the field in finer position ...like...".xfa.host.resetData("form1.#subform[0].TextField1[0]"); } ". You are genius!! Thanks.
Views
Replies
Total Likes
Hi Paul,
I got a validation problem on a fillable form and want to seek your advice. Can I e-mail my form to you for advice,please?
Views
Replies
Total Likes
Sure ......send it to LiveCycle8@gmail.com
Paul
Views
Replies
Total Likes
thanks for ur post Paul got a new think to learn on rese
tting the fields ... great !!!!!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies