Expand my Community achievements bar.

Issue in AWS_ACTION rawValue

Avatar

Level 2

I

My form has 2 routes/buttons:  Approve or Reject.


If the form is rejected, I must validate that they entered comments in
the reject field before submitting.

How do I find the value of which button is selected through
javascript...so that I can enforce my validation?

I tried giving an alert message at the beginning of the script to display the aws_action value and it seems to display "approve" for both the buttons.

the aws_choice always seems to take the first choice value . How do I resolve this ?

Thanks

Deepthi

diptichand@gmail.com

16 Replies

Avatar

Former Community Member

It has been a while since I used these fields but here is what I remember.

The AWS_CHOICE field contains a comma delimited list of available actions for this step. When the form loads there is code on the Form Ready event of the AWS_ACTION field that will parse the string and populate the Action list. So if you need to know which selection was made you woudl have to interrogate the AWS_ACTION field to know what action they chose. Expand the size of the AWS_CHOICE field (and set it to multiline) and you shoudl begin to see the full contents of the field.

Hope that helps

Paul

Avatar

Level 2

I tried this . But it dint help .when I give alert message to check what value the AWS_ACTION takes, I always get the first choice value for both approve and deny buttons . I am trying this because If the form is denied, I must validate that they entered comments in

the reject field before submitting. So it should be able to differentiate between approve and deny but it shows the same alert for both approve and deny .

Avatar

Level 2

I created the forms using adobe designer and I deployed it in adobe livecycle workbench . I could see the output in adobe workspace where I get to fill out the details in the form and see the flow of the process I created .

In the designer where I created the form, I modified the script to just show the alert using app.alert(AWS_ACTION.rawValue) and it shows "approve" for both the buttons in workspace when I deploy it .

Avatar

Former Community Member

Did you add your script to the AWS_SUBMIT button where it determines the type of submission or did you add your javascript code elsewhere?

Paul

Avatar

Level 2

Yes . I added it in the aws_submit part . here is the script . this is the full script but the part that I modified is way below in the else part where I have declared saction and given alerts for approve and deny . it is not able to differentiate approve and deny.

Form.Comments.AWS_SUBMIT::click - (JavaScript, client)

// This is the AWS_SUBMIT click script

if (xfa.host.name == "Acrobat")

{

// get the local URL of the PDF, to check to see if it's a file on disk or from the web.

var sURL = event.target.URL;

if (sURL == null) sURL = "";

// we can email only if there is a Workflow Server email address.

// we allow email submission only if the pdf is loaded from disk (not in a browser)

// Detecting if it is from local disk is by seeing if the URL starts with file:// (rather than htpp://, for instance)

if ( (sURL.indexOf("file://") == 0) )

{

if (AWS_STATUS.rawValue == "Submitted") {

app.alert("This task item has already been submitted.");

bSubmit = false;

}

else {

// set this boolean to false if any of the criteria fails

var bEmail = true;

// check for an empty LiveCycle server email address

if (AWS_MAILTO.rawValue == null || AWS_MAILTO.rawValue == "") {

// prompt for an email address to send the submission to

AWS_MAILTO.rawValue = app.response("This form does not contain the email address for a LiveCycle Server. Please enter the LiveCycle Server email address now.", "Task Item Submission Information");

if (AWS_MAILTO.rawValue == null || AWS_MAILTO.rawValue == "") {

bEmail = false;

}

}

// check for either a taskId or a business process name

// If there is a taskId it is presumed that you are "participating"

// in the middle of a business process, whereas if there is no

// taskId it is presumed that you want to "initiate" a new

// business process.

// if there is no taskId, prompt for the business process name

if (bEmail) {

if ( (AWS_TASKID.rawValue == null || AWS_TASKID.rawValue == "") &&

(AWS_PROCESSTYPE.rawValue == null || AWS_PROCESSTYPE.rawValue == "") ) {

// prompt for the business process name

AWS_PROCESSTYPE.rawValue = app.response("This form does not contain a taskId or a business process name. Please enter the business process name that you wish to initiate with this form.", "Task Item Submission Information");

if (AWS_PROCESSTYPE.rawValue == null || AWS_PROCESSTYPE.rawValue == "") {

bEmail = false;

}

}

}

if (bEmail) {

var mailto = AWSMAILTO.rawValue;

if (_mailto.indexOf("mailto:") != 0)

_mailto = "mailto:" + _mailto;

event.target.submitForm({cURL: _mailto,

bEmpty: true, // Post all fields (true), or do Not post all fields (false)

cSubmitAs: AWS_SUBMIT_TYPE.rawValue, // Post in XDP or PDF format

cCharset: "utf-8"});

// set status to "Submitted" so that another send is not attempted via email.

AWS_STATUS.rawValue = "Submitted";

}

}

}

else { // The PDF did not originate from file:// (i.e. not from local disk)

// do a normal web acrobat submit

if(AWS_SUBMIT_TYPE.rawValue == "PDF"){

PDF_SUBMIT.execEvent("click");

}

else{

var sAction = Form.Comments.AWS_ACTION.rawValue;

if(sAction == "Approve"){

xfa.host.messageBox("Approve Clicked");

}

if(sAction == "Deny"){

xfa.host.messageBox("Deny Clicked");

}

FSSUBMIT_.execEvent("click");

}

}

}

else // other web rendering submit (xfa.host.name not == "Acrobat")

{

if(AWS_SUBMIT_TYPE.rawValue == "PDF")

PDF_SUBMIT.execEvent("click");

else{

FSSUBMIT_.execEvent("click");

}

}

Avatar

Former Community Member

Ok I found the issue ( I Think). Did you add the Form Bridge object from the Designer library onto your form or are you allowing your renderer to add it for you? This is the code that allows communication between the Flex application (workspace) and the PDF. Your answer will determine the best approach to take.

Paul

Avatar

Level 2

I did add the form bridge to my form but it still doesn’t show me any change . Do I have to change some settings or properties?

Avatar

Former Community Member

The issue is in that Form Bridge. There was some code added for submitting guides where there was a xfa.form.remerge() command being executed. This worked fine for guides but this command will clear the AWS_ACTION list and this is why you are always getting the 1st item in the list only. This has been fixed in Service Pack 1 but you will only make use of it if you do not put the Form Bridge on your form and allow the renderer to insert it. The installer cannot go back and remove this object from the Designer library. So you can either get SP1 and do not put th eform bridge on, or leave things the way they are and go into the Form Bridge code and do a serach for remerge(). You will find 2 instances ...comment then both out and now your code should work.

Let me know which option you will choose and that it worked for you.

Paul

Avatar

Level 2

That really helped. Now it works . Thanks a lot . I used the second option . I commented out the xfa.remerge() instances.

Avatar

Former Community Member

Just remember that if you update your Designer then that Form Bridge object may get updated and you will have to check that code again .....at least until the fix comes out for that issue.

Paul

Avatar

Former Community Member

Hi

I am facing the same problem as discribed by you.

I tried commenting the xfa.remerge() instances in FORM_BRIDGE_VERSION = "2.0" it had 3 instances

But still AWS_ACTION.rawValue is same every time.

Please Help.

Avatar

Level 2

Did u add the form bridge object onto ur form ?

Avatar

Former Community Member

yes, I have the form bridge object on my form

and I have commented the  xfa.form.remerge().

Is there anything else that I have to do.

Can you please send me any sample how u did this.

Avatar

Level 2

I followed the same steps as mentioned in this thread and it worked for me . I didn’t make any other changes.

Avatar

Level 2

Do you know if this should work out of the box for ES3? And should it work for PDF forms, or only XDP? Our form is similar to what's described above, but needs to be PDF as it holds digital signatures.

Thanks