Expand my Community achievements bar.

AEM InvokeService and guideBridege.validate() don't work together

Avatar

Level 2

Hi All,
We have a serious issue with AEM InvokeService (i.e. guidelib.dataIntegrationUtils.executeOperation() ) and guideBridege.validate() as the invokeService never terminates after guideBride.validate() returns true. We have an adaptive form consisting of 6 tabs and 6th tab is Review and Submit. Once user clicks on Submit button(type="button"), i will run guideBride.validate on each tab and once it returns true, i will invokeService which could be either POST (If user hasn't saved the form) or PUT operation. If I disable the validation then the form gets submitted but if i enable the validation, it shows the errors messages for all required fields if they are left blank and finally control goes to executeOperation but never exits.

In the sample code below we are never going to see "after fdm" in the console after successfull validation. But if i disable guideBridge.validate then form will get submitted and we can see the log message "after fdm" in browser console.


var operationInfo = {
"formDataModelId": "/content/dam/formsanddocuments-fdm/test",
"operationTitle": "Get data",
"operationName": "get_16166693155410"
};
var inputs = {
"id" : id_1,
"name" : name_1,
"frmDate" : date
};
var outputs = {
};
var createResponse = function(jsonResult){
alert("jsonREsult="+jsonResult);
};
var ci_errors = [];
guideBridge.validate(ci_errors,"guide[0].guide1[0].guideRootPanel[0]",true);
if(ci_errors.length === 0 ) {
console.log("Inside err len ===0 ");
guidelib.dataIntegrationUtils.executeOperation(operationInfo, inputs, outputs, createResponse);
console.log("after fdm");
}

Because of this issue we couldn't proceed with UAT and request you all if you could take some time to troubleshoot this issue or if there is any other alternate implementation.

If it is a simple POST operation then guideBridge.submit() works fine with guideBridege.validate(). We have issue only with InvokeService and guideBridege.validate().

Please let me know if you need any additional details.



Thanks & Regards
Suresh

 

@Mayank_Gandhi 

@workflowuser 

9 Replies

Avatar

Level 2

Since i couldn't upload the TestForm, I tried to provide the code of Submit button where we can that "after fdm" will never print in the browser console after succcessful validation 3 required fields.

 

 

var operationInfo = {
"formDataModelId": "/content/dam/formsanddocuments-fdm/test",
"operationTitle": "Get data",
"operationName": "get_16166693155410"
};
var inputs = {
"id" : id_1,
"name" : name_1,
"frmDate" : date
};
var outputs = {
};
var createResponse = function(jsonResult){
alert("jsonREsult="+jsonResult);
};
var ci_errors = [];
guideBridge.validate(ci_errors,"guide[0].guide1[0].guideRootPanel[0]",true);
if(ci_errors.length === 0 ) {
console.log("Inside err len ===0 ");
guidelib.dataIntegrationUtils.executeOperation(operationInfo, inputs, outputs, createResponse);
console.log("after fdm");
}

Avatar

Employee Advisor

@sureshp20051226 This is something I have previously seen. You might want to move the fdm and validate on two different fields. The context is lost with the initial approach that you have taken. 

Suggested approach: 

on validate -> fire an event from the current field and catch it on another field and let the other field call the FDM

 

Avatar

Level 2

@Mayank_Gandhi@MorisMonk  Thanks a lot for your support on troubleshooting this. Initially i tried to move the validations to a hidden field "validationFlg" and on Submit i used to read this value but it didn't work. Now based on your suggestions  i tried to keep additional button "Validate" and moved the validation logic to onClick of this button and upon successful validation i enable the Submit button. This approach does seems to work but not sure If i can convenience out business about introduction of new button "Validate". however this does seems like a work around solution till Adobe provide a fix for this. will keep you updated once i implement this to my actual form. 

Thanks again 

Avatar

Level 5
Hi Suresh. I am assuming you can see the "Inside err len ===0 " before "after fdm" in your console log? Are there any errors in your console log? Or error.log ? Can you tell if the record is being created? Cheers Moris

Avatar

Level 2
@MorisMonk there are no other errors. if I enter values in 3 fields then i could see message "Inside err len ===0" and invokeService do not seems to get triggered and not seeing the next console log "after fdm".

Avatar

Level 5

After the guidelib.dataIntegrationUtils.executeOperation fires, do you see "guideContainer.af.dermis" in the Network tab of your browser console?

And do you have any Validate expressions in your form?

Avatar

Level 2
@MorisMonk I just have additional future date validation on the date picker and once i disabled it then i could see form getting invoked and could see guideContainer.af.dermis in the network tab. if we have any validation rule then i think it is getting failed.

Avatar

Level 5

Nice work. I reproduced the same. Have you raised a case with Adobe Support?

Workaround? Can you move the validation to another area of the form, have the Submit button initially disabled?

Example, a Terms and Conditions type of checkbox just above the Submit button that does the Validate and enables the button.