Own Submission and validation

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

Own Submission and validation

goral
HI.
I create

<xf:submission action="http://10.10.101.58/saveForm.html" validate="true" relevant="true" id="submitId" method="post"/>

and in body element <xf:submit submission="submitId"><xf:label>Przejdź dalej</xf:label><xf:revalidate/></xf:submit>

How to do revalidate action who marks invalid fields as do submit button (oxf.fr.detail.buttons.*.*).

Thank you

Reply | Threaded
Open this post in threaded view
|

Re: Own Submission and validation

Alessandro  Vernet
Administrator
Hi,

Are you adding this to a form running inside Form Runner, that you created with Form Builder? You shouldn't need to have that <xf:revalidate/> (also, the way it is there, it won't have any effect.) Are you saying that you'd like the button, when clicked, to show the error for the non-visited but invalid fields, as the default Save and Submit buttons do?

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

Re: Own Submission and validation

goral
Hi.
Where i should insert <xf:revalidate/>?

" Are you saying that you'd like the button, when clicked, to show the error for the non-visited but invalid fields, as the default Save and Submit buttons do?"

Yes, i want to have submit button, witch before submission do revalidate, how to do this?
Reply | Threaded
Open this post in threaded view
|

Re: Own Submission and validation

Alessandro  Vernet
Administrator
Hi,

As mentioned in my previous comment, you shouldn't need the <xf:revalidate/>. The default "Submit" button does all this automatically for you: make sure that the validation is done, show all the errors for the fields that haven't been visited yet, and prevent the submission if anything isn't valid. Am I missing something?

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

Re: Own Submission and validation

goral
Hi
I didn't understend, sorry.
I changed to <xf:submit submission="submitId"><xf:label>Przejdź dalej</xf:label></xf:submit> 
And when i cliked on button "Przejdź dalej" and i didn't filed out required fileds, the fields weren't marked as invalid why? I missed something?
Reply | Threaded
Open this post in threaded view
|

Re: Own Submission and validation

Alessandro  Vernet
Administrator
Hi,

I didn't realize (or forgot!) you were creating your own button. If you have your own button, and on click would like to mark all the controls "visited", so their error shows both under the control and in the error summary, you need to do something similar to what is done here, i.e. dispatching fr-visit-all to the error summary:

https://github.com/orbeon/orbeon-forms/blob/5c2654d30d1bc38ee4546be710aa3eb1d0fb5ac2/src/resources/apps/fr/components/components.xsl#L293

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

Re: Own Submission and validation

goral
Hi.
I changed xf:submission to:

<xf:submission action="http://10.10.101.58/saveForm.html" validate="true" relevant="true" id="submitId" method="post">
<xf:action ev:event="xforms-submit-error">
           <xf:dispatch name="fr-visit-all" targetid="error-summary-control-top"/>
</xf:action>
</xf:submission>

i changed error-summary-control-top to error-summary-control-bottom and it didn't work, why?


Reply | Threaded
Open this post in threaded view
|

Re: Own Submission and validation

Alessandro  Vernet
Administrator
Hi,

Would you be able to attach a sample (minimal) form in which you place that button, and that I can run here to reproduce what you are seeing?

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

Re: Own Submission and validation

goral
Reply | Threaded
Open this post in threaded view
|

Re: Own Submission and validation

Alessandro  Vernet
Administrator
You were saying:

goral wrote
[...] cliked on button "Przejdź dalej" and i didn't filed out required fileds, the fields weren't marked as invalid why
But I don't see any field marked as required in the form (I'm finding no occurrence of "required" in the source). Am I missing something?

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

Re: Own Submission and validation

goral
And attribute constraint in "<xf:bind id="ID24" nodeset="wnio:TrescDokumentu/wnio:Tytul" relevant="true()" constraint="(.!='') and (string-length()&lt;31)"/>" ?
Reply | Threaded
Open this post in threaded view
|

Re: Own Submission and validation

Alessandro  Vernet
Administrator
I see! But I wasn't able to reproduce this. When the field is empty, it is properly marked as invalid:



And when you enter a value, the alert indicator goes away, as expected:



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