Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

invoking complete button in workspace from xdp form rendered as HTML

Avatar

Level 2

Two questions -

1. I render an xdp form as HTML. When in workspace, is there a way to invoke the complete button from the form? 

2. I see a save button in workspace when rendering xdp as html. Is there a way to remove the save button?

14 Replies

Avatar

Employee

1. When a form design does not contain a submit button, Workspace disables the Complete button, and users cannot submit the form. When a form design contains a submit button, Workspace hides the submit button and enables the Workspace Complete button[0]. You can use the complete button in place of actual submit button.

 

2. You can disable/hide the save button in HTML Workspace after modifying /libs/ws/js/runtime/templates/taskdetails.html and /libs/ws/js/runtime/templates/startprocess.html, as this is the part of customizing Workspace[1].

 

[0]: https://help.adobe.com/en_US/AEMForms/6.1/DesignerHelp/WS92d06802c76abadb-728f46ac129b395660c-7bb3.2...

[1]: https://experienceleague.adobe.com/docs/experience-manager-65/forms/use-aem-forms-workspace/generic-...

 

Avatar

Level 2

Hi Mayank,

 

For your answer to 1. This is not the behavior I am seeing when xdp is rendered as HTML in workspace. The complete button has no link to any buttons on the form and all it can be used for is to submit. It does validations if xfa.host.validationsEnabled is set to true, but other than that, it executes no button in the form. If you want I can show this to you in a meeting session and you can clarify what you are saying. Also, the link that you have provided applies to when you are submitting the form as PDF, not when the form is XDP rendered as HTML. Which takes me back to my original question, how can I invoke the complete button in workspace from my form when I it is an xdp rendered as html.

 

For 2. I'll check out the link you provided and see if I can follow the directions. Thanks.

Avatar

Level 2

Hi Mayank,

 

My form has a lot of links to internal webservices. Is there a way I can send you the form separately instead of posting on a public forum?

 

Thanks,

Ravi.

Avatar

Employee

@RaviMRam , As we observed in the meeting, it is not working for you because you are using multiple submit buttons in your form. A form should only have one submit button. Also, you should put all the validation logics in the validate event.

Avatar

Level 2

Mayank,

 

I created a small sample application to see if the presubmit event works and it doesn't for me. Can we do another session sometime next week and you can tell me what I am missing?

Avatar

Employee

It's because there are still two issues in your form:

1. You are executing the validation script in calculate event instead of Validate event of the form.

2. execValidate() returns empty[0]. Why you are checking its return value as below?

 

if ( MainForm.execValidate() == true )

[0]: https://help.adobe.com/en_US/AEMForms/6.1/DesignerScriptingRef/WS92d06802c76abadb-3e14850712a151d270...

 

Avatar

Level 2

Ok Mayank,

 

Can you tell me then how to code the following login in the preSubmit event of the submit button. We can use my test form as the guinea pig.

 

Validate the form (for required fields etc.)

if validation succesful

{

     Make a webservice call

     if webservice call successful

    {

          submit form

     }

    else

    {

            cancel submission

     }

}

else

{

    cancel submission

}

 

Thanks,

Ravi.

Avatar

Employee

I have done the same in this form[0]. I have used data connection in Designer to call the WSDL which adds the input A and B. 

 

JavaScript used:

form1::preSubmit:form - (JavaScript, client)
validation=true;
if(form1.MainForm.Fields.Body.Add.intA.isNull || form1.MainForm.Fields.Body.Add.intB.isNull) // checking for null values
validation=false;

if(validation)
form1.MainForm.Fields.AddBtn.execEvent("click"); //if validation is passed, making webservice call to add A & B

if(form1.MainForm.Fields.AddResult.isNull) //checking if webservice call output is empty
xfa.event.cancelAction=1; //cancelling the submit if output is empty

[0]:https://drive.google.com/file/d/18G7jPX7uOuGKjZ5q0VYqCNZc8njFb_xL/view?usp=sharing

Avatar

Level 2

I tried out your form here and it submits without doing any validations. Did you test out the form at your end? Maybe, I am missing something.

 

Also, are you testing out the form rendering it as html and submitting outside of workspace?

Avatar

Employee

Yes, I did. I am rendering the form as HTML only. It is working as expected for me, as you can see below.

 

Mayank_Tiwari_0-1636396638825.png

 

Avatar

Employee

l would request you to log a Support ticket for this, as this requires deeper investigation at your side. Thanks.