Expand my Community achievements bar.

SOLVED

Form validation with Regular type button

Avatar

Former Community Member

Hello,

I got form with many fields of [value-type=user-entered required], or fields which have some scripting in their validate event handler.

When I use submit button to submit form over http, the form is validated prior submission. Then, when I use execute button (to submit form over SOAP), validation is not called at all.

What is the standard way, to have e.g. required fields on a form and to validate (check values, display error messages, block submission ) form prior to send it over soap ?

I searched the forum history, but I found only the way, that validation is completely scripted and this is called by regular-type button. After it is valid, form is submitted by executing click event on execute-type button.

Thanks.

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

When the soap support was added it was intended to get partial informnation into the form and out of the form (think of initializinng dropdown list, filling tombstone information etc). That is why the validations do not fire automatically like they do for a regular submission. 

To make the form behave the way you want I woudl add a second button (type is regular) then right code that would fire the validations on the form then call the web service assuming that the validations passed. Assuming the root node of your form is form1, you can do something like this:

if (form1.execValidate) {

     WebServicesubmissionButtonName.execEvent("click")

}

By calling the validations on form1, then all validations in objects below this container are executed. If all validations pass a true valie is returned and the webservice submission is triggered. I woudl also make the real WS invoke button invisible.

Hope this helps

Paul

View solution in original post

2 Replies

Avatar

Correct answer by
Former Community Member

When the soap support was added it was intended to get partial informnation into the form and out of the form (think of initializinng dropdown list, filling tombstone information etc). That is why the validations do not fire automatically like they do for a regular submission. 

To make the form behave the way you want I woudl add a second button (type is regular) then right code that would fire the validations on the form then call the web service assuming that the validations passed. Assuming the root node of your form is form1, you can do something like this:

if (form1.execValidate) {

     WebServicesubmissionButtonName.execEvent("click")

}

By calling the validations on form1, then all validations in objects below this container are executed. If all validations pass a true valie is returned and the webservice submission is triggered. I woudl also make the real WS invoke button invisible.

Hope this helps

Paul

Avatar

Former Community Member

Sorry for late reply and thanks, this is what I needed to know.

Just to be sure,can I have a few more questions arround?

Iif I have a textField, which is declared as a required via gui and later I implement validation event, does validation mechanism still provide check that the field was filled ?

Is there some variable / property, which would hold last validation error message, after execValidate is called ?

Thanks

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----