These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Change value to default value on Save Event

Gattaca714
Registered: Dec 16 2009
Posts: 25

I'm using the Pre-Save event to trigger the action.
 
My goal: Right before the document is saved, I want the value that is in fldBallotGroupCount to be set as the default value.
 
Here is my code:
---------------------
 
form1.BallotOrder.fldBallotGroupCount::preSave - (JavaScript, both)
  
this = form1.BallotOrder.fldBallotGroupCount.RawValue;
 
----------------------
 
Right now it saves the value in the field, but it doesnt save it as the default when I open it in livecycle.
 
Any help would be appreciated.
 
Thanks.

My Product Information:
LiveCycle Designer, Windows
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Sorry but I don't understand what you're trying to do.

From what I'm seeing you assign the value of "fldBallotGroupCount" to itself at the preSave:Event.
What is that supposed to achieve?

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

Gattaca714
Registered: Dec 16 2009
Posts: 25
My goal is to change the default value from acrobat not livecycle. this is a static form and this field triggers some other fields to hide based on the number, but it will only hide based on the default value for some reason.
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
It's still a mystery to me what you do...
What do you mean by "default value of Acrobat"?
What kind of field is "fldBallotGroupCount" and how do you trigger other fields to hide them?

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

Gattaca714
Registered: Dec 16 2009
Posts: 25
What do you mean by "default value of Acrobat"?

I mean, that when the customer using Acrobat puts a number in fldBallotGroupCount I want that number to become the default number of that field when it's saved. fldBallotGroupCount is a numeric field.

how do you trigger other fields to hide them?

For example, I have field fldBoDescription[2] with the following code with event ready:layout. What this code says is if fldBallotGroupCount = 1 or 2 then hide, if 3,4, or 5 then visible. The problem I have is that it somehow works using the default value of fldBallotGroupCount, not the regular value in the field.

This is a static form, so the hiding of fields only happens at the creation of the document, not after.

if(fldBallotGroupCount.rawValue == 1){
this.presence = "hidden";
}
else if(fldBallotGroupCount.rawValue == 2){
this.presence = "hidden";
}
else if(fldBallotGroupCount.rawValue == 3){
this.presence = "visible";
}
else if(fldBallotGroupCount.rawValue == 4){
this.presence = "visible";
}
else if(fldBallotGroupCount.rawValue == 5){
this.presence = "visible";
}
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Well,

to assign a value to you numeric field you can use

this.rawValue = form1.BallotOrder.fldBallotGroupCount.rawValue;
But, in a static form you cannot change the presence at runtime.
I think you're testing you form in the PDF Preview of Designer, there it works, because Designer behaves as a server.
If you run the form in Acrobat or Reader the presence won't change.

Applying formatting by using client-side scripts

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs