Clearing of all the form validation error messages upon clicking of a button

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Clearing of all the form validation error messages upon clicking of a button

Rizwan
This post was updated on .
Hi All,



Refereing to the image attached
1.Clicking on validate button will give the error messages, below is the configuration
        <property as="xs:string"
            name="oxf.fr.detail.process.validate.form"
            value='require-valid
                        then send(uri = "<TargetUrl>", method="POST", data-format-version="edge", prune="false")
           then navigate("javascript:reauthForSplit()")'>
        </property>

2.Upon clicking on save button immediately after clicking on validate button,i want to clear of all the error messages, so that validation is different for validation and save buttons
<property as="xs:string"
                                name="oxf.fr.detail.process.save.bolero-validate"
                                value='if ("(count(//form/ReferencesAndRelatedDocs/ReferencesGrid/ReferencesGrid-iteration[ReferenceValue != &apos;&apos;])=0) and  //form/RequestInfo/amendStatusCode ne &apos;15&apos;") then error-message(message = "At least one reference number in the references section is required.")
</property>

How to clear all the error messages when we click on button ??
Reply | Threaded
Open this post in threaded view
|

Re: Clearing of all the form validation error messages upon clicking of a button

Alessandro  Vernet
Administrator
Hi Rizwan,

What error message would you like to clear? The one shown by error-message() displays in a dialog, as illustrated by your screenshot, and goes away when users click on that dialog's OK button. Are you referring to the list of errors shown at the bottom of the form? In that case, maybe you're looking for the unvisit-all() action? See:

https://doc.orbeon.com/form-runner/advanced/buttons-and-processes/actions-form-runner.html#other-actions

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Clearing of all the form validation error messages upon clicking of a button

Rizwan
This post was updated on .
Hi Alex,
Thank you for the response, i was referring to  list of errors shown at the bottom of the form and unvisit-all  is now clearing all the error messages which was our expectation.

But while navigating to other tabs , for recently visited tabs validation errors are not getting cleared.
could please provide the solution.

Regards
Rizwan
Reply | Threaded
Open this post in threaded view
|

Re: Clearing of all the form validation error messages upon clicking of a button

Alessandro  Vernet
Administrator
Hi Rizwan,

I'm glad unvisit-all does the trick, at least in one situation. What do you mean by "tabs"? Are you using the wizard view? In that case too, unvisit-all clears the errors for all the fields, accross pages of the wizard a.k.a. tabs. But I am maybe misunderstanding the situation you're describing?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Clearing of all the form validation error messages upon clicking of a button

udayram
This post was updated on .
Hi Alex,

We are using Form builder and configured wizard. As per your suggestion, we used unvisit-all for clears the errors for all the fields, accross pages of the wizard but does not work. Below are screenshot and scenarios attached for your reference.

Section:1


Section : 2


Scenario 1 : Section 1 I have inserted data for first field for text1 and text2 I left it blank it is mandatory field anyway.

Scenario 2 : I have navigated Section 2 tab and data entered only text 1 field and other fields left blank with error messages.

Scenario 3: Now I am saving the form Section 1 and Section 3 all mandatory field error messages cleared but Active tab not cleared for using unvisit-all.

We need solution for clears the errors for all the fields include active tab, accross pages of the wizard.

Looking forward to your favorable reply.

Thanks,
Uday
Reply | Threaded
Open this post in threaded view
|

Re: Clearing of all the form validation error messages upon clicking of a button

Alessandro  Vernet
Administrator
Hi Uday,

You're saying that you do the steps in "scenario" 1, then 2, then 3, and your "save" does an unvisit-all, and you'd like the error summary to be cleared after that, but some errors still show. Is that correct?

If that's the case, but you're still seeing errors, do the errors still show if your process does *just* the unvisit-all? If the error show, could you try if you can reproduce this with release 2016.2.2 (that you can download from http://www.orbeon.com/download)? And if it does happen with 2016.2.2, could you share with us the source of a minimal form that shows the problem?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Clearing of all the form validation error messages upon clicking of a button

udayram
Hi Alex,

Thank you for your input. We are upgraded "orbeon-2016.3.201612302139-CE" version. the changes are not available same issues we are getting for Clearing of all the form validation error messages.

Could you please confirm the unvisit-all changes available for this version.

Thanks
Uday
Reply | Threaded
Open this post in threaded view
|

Re: Clearing of all the form validation error messages upon clicking of a button

Alessandro  Vernet
Administrator
Hi Uday,

Yes, `unvisit-all` is available in 2016.3 CE. As mentioned in my previous message, are you still seeing the same error if the process *just* does an `unvisit-all`? And if that is the case, could you share with us a minimal form that we can run here to reproduce the problem?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Clearing of all the form validation error messages upon clicking of a button

udayram
This post was updated on .
Hi Alex,

Thank you for your input.

I tried "unvisit-all" for latest 2016.3 version it is working as expected without any issue. But while customizing configuration as below it is not working as expected. Please have a look below customize code and guide us how to achieve for the same.

<property as="xs:string"
name="oxf.fr.detail.process.save.bolero-bill-of-lading.bolero-bill-of-lading-sd-705-dev-v1-uday"
value='unvisit-all
then if ("(count(//form/ReferencesAndRelatedDocs/ReferencesGrid/ReferencesGrid-iteration[ReferenceValue != &apos;&apos;])=0) and  //form/RequestInfo/amendStatusCode ne &apos;15&apos;") then error-message(message = "At least one reference number in the references section is required.")
else (
if ("(string-length(//form/Parties/ShipperSection/ShipperRID) + string-length(//form/Parties/SurrenderPartySection/SurrenderPartyRID) + string-length(//form/Parties/ConsigneeSection/ConsigneeRID)+string-length(//form/Parties/ToOrderSection/ToOrderRID) +string-length(//form/Parties/PublishToSection/PublishToRID) = 0)") then error-message(message = "You must enter at least one Party RID to indicate who has requested the booking")

else (
set-data-status(status="safe") then
send(uri = "http://localhost:8080/ROOT/saveStructBill" , method="POST", data-format-version="edge", prune="false")
then xf:show("result-dialog")
then success-message(message="Save is Successful!")
)
)
recover navigate("javascript:alert(&apos;Validation is failed&apos;);")'>
</property>
Reply | Threaded
Open this post in threaded view
|

Re: Clearing of all the form validation error messages upon clicking of a button

Alessandro  Vernet
Administrator
Hi Uday,

Can you tell us more about what isn't working with this process? What part isn't working? What was the expected behavior, and what was the observed behavior?

Also, I'd recommend you put the code inside the <property> element, and also indent the code to make it easier to read. As in:

https://gist.github.com/avernet/364ab7efe66b685a9b6b82032a780e45

If you get an error when the process run, do you have anything telling error in your orbeon.log? If you can find anything useful there, can you attach that file to your response.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Clearing of all the form validation error messages upon clicking of a button

udayram
This post was updated on .
Hi Alex,

I have tried the format as you provided in the above link. It is not working as expected.

I am getting exception.orbeon.log



As above mentioned issue in the screenshot if any validation message in the active tab not clearing and not clearing red text color in the tab section while saving the document. We need to clear all validation error message while saving the document.



Reply | Threaded
Open this post in threaded view
|

Re: Clearing of all the form validation error messages upon clicking of a button

Alessandro  Vernet
Administrator
Hi Uday,

I'm afraid this is complex enough that I won't be able to help you very effectively on this community forum. Instead, if you have an Orbeon Forms PE subscription, I recommend you contact us through your normal support channel.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet