How display validation alerts with the custom submission button

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

How display validation alerts with the custom submission button

Chunyu_uk
Hello,

We have the following code in the form body.

<xh:td>                               
                                <xf:trigger id="complete-appraisal-confirm-control" bind="complete-appraisal-confirm-bind">                                   
                                    <xf:label ref="$form-resources/complete-appraisal-confirm/label"/>                                   
                                    <xf:hint ref="$form-resources/complete-appraisal-confirm/hint"/>                                   
                                    <xf:alert ref="$fr-resources/detail/labels/alert"/>                                   
                                    <xf:action ev:event="DOMActivate">                                       
                                        <xf:setvalue bind="status-bind" value="'sent for review'"/>                                       
                                        <xf:setvalue bind="show-complete-section-bind" value="'false'"/>                                       
                                        <xf:send submission="create-instance"/>                                   
                                    </xf:action>
                                </xf:trigger>                           
                            </xh:td>


And the relevant submission event in the head of the form.

  <xf:submission id="create-instance" method="put" instance="fr-form-instance"
                           replace="instance"
                           serialization="application/xml"
                           validate="true"
                           relevant="true"
                           resource="http://localhost:8040/orbeonapi/crud/erdf/appraisal/data/{xxf:instance('fr-parameters-instance')/document}/data.xml">               
               
<xf:header combine="replace">                   
                   
<xf:name>Accept</xf:name>                   
                   
<xf:value>application/xml</xf:value>               
               
</xf:header>               
               
<xf:action ev:event="xforms-submit-error">                   
                   
<xf:message level="modal">                       
                       
<xf:output value="'There are validation errors. Please check your selections and entries, and retry once all fields have been filled out.'"/>                   
                   
</xf:message>               
               
</xf:action>               
               
<xf:action ev:event="xforms-submit-done">                  
                   
<xf:setvalue ref="xxf:instance('fr-persistence-instance')/data-safe-override">true</xf:setvalue>
                   
<xf:send submission="wf-submit-appraisal"/>
                   
<xf:load resource="/esif-web/appraisal/{instance('fr-form-instance')//*:status}/for/{xxf:instance('fr-form-instance')/*:uids/*:application/string()}"/>
                   
<!--<xf:load resource="/esif-web/applications/dashboard"/>--> 
               
</xf:action>           
           
</xf:submission> 


We could have a validation error as a pop up message, but we would like to have the red validation alerts to be displayed as well.

How can we display the validation errors as the red alerts at the bottom of screen which is like the default save or submit button from Orbeon form builder and runner?


Could you please advise?


Thanks,

Chunyu

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: How display validation alerts with the custom submission button

Alessandro  Vernet
Administrator
Hi Chunyu,


I think that you're looking for the visit-all action, which will result in marking all controls "visited", so their related error shows, in case there is one:


To run this action, you'd have to create a process that runs it (defined it in your properties, more info about this in the page linked above), and run it with process:runProcessByName() as done by process-button.xbl:


Alex

On Mon, Jun 22, 2015 at 1:23 AM, Chunyu <[hidden email]> wrote:
Hello,

We have the following code in the form body.

<xh:td>                               
                                <xf:trigger id="complete-appraisal-confirm-control" bind="complete-appraisal-confirm-bind">                                   
                                    <xf:label ref="$form-resources/complete-appraisal-confirm/label"/>                                   
                                    <xf:hint ref="$form-resources/complete-appraisal-confirm/hint"/>                                   
                                    <xf:alert ref="$fr-resources/detail/labels/alert"/>                                   
                                    <xf:action ev:event="DOMActivate">                                       
                                        <xf:setvalue bind="status-bind" value="'sent for review'"/>                                       
                                        <xf:setvalue bind="show-complete-section-bind" value="'false'"/>                                       
                                        <xf:send submission="create-instance"/>                                   
                                    </xf:action>
                                </xf:trigger>                           
                            </xh:td>


And the relevant submission event in the head of the form.

  <xf:submission id="create-instance" method="put" instance="fr-form-instance"
                           replace="instance"
                           serialization="application/xml"
                           validate="true"
                           relevant="true"
                           resource="<a href="http://localhost:8040/orbeonapi/crud/erdf/appraisal/data/%7Bxxf:instance(&#39;fr-parameters-instance&#39;)/document%7D/data.xml" target="_blank">http://localhost:8040/orbeonapi/crud/erdf/appraisal/data/{xxf:instance('fr-parameters-instance')/document}/data.xml">               
               
<xf:header combine="replace">                   
                   
<xf:name>Accept</xf:name>                   
                   
<xf:value>application/xml</xf:value>               
               
</xf:header>               
               
<xf:action ev:event="xforms-submit-error">                   
                   
<xf:message level="modal">                       
                       
<xf:output value="'There are validation errors. Please check your selections and entries, and retry once all fields have been filled out.'"/>                   
                   
</xf:message>               
               
</xf:action>               
               
<xf:action ev:event="xforms-submit-done">                  
                   
<xf:setvalue ref="xxf:instance('fr-persistence-instance')/data-safe-override">true</xf:setvalue>
                   
<xf:send submission="wf-submit-appraisal"/>
                   
<xf:load resource="/esif-web/appraisal/{instance('fr-form-instance')//*:status}/for/{xxf:instance('fr-form-instance')/*:uids/*:application/string()}"/>
                   
<!--<xf:load resource="/esif-web/applications/dashboard"/>--> 
               
</xf:action>           
           
</xf:submission> 


We could have a validation error as a pop up message, but we would like to have the red validation alerts to be displayed as well.

How can we display the validation errors as the red alerts at the bottom of screen which is like the default save or submit button from Orbeon form builder and runner?


Could you please advise?


Thanks,

Chunyu

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: How display validation alerts with the custom submission button

Chunyu_uk
Hi Alex,

We will try whether we could get it working according to you suggestions.
Thanks,
Chunyu

On 22 June 2015 at 22:38, Alessandro Vernet <[hidden email]> wrote:

> Hi Chunyu,
>
>
> I think that you're looking for the visit-all action, which will result in
> marking all controls "visited", so their related error shows, in case there
> is one:
>
> https://github.com/orbeon/orbeon-forms/wiki/Form-Runner-~-Buttons-and-Processes#other-actions
>
> To run this action, you'd have to create a process that runs it (defined it
> in your properties, more info about this in the page linked above), and run
> it with process:runProcessByName() as done by process-button.xbl:
>
> https://github.com/orbeon/orbeon-forms/blob/master/src/resources-packaged/xbl/orbeon/process-button/process-button.xbl
>
> Alex
>
> On Mon, Jun 22, 2015 at 1:23 AM, Chunyu <[hidden email]> wrote:
>>
>> Hello,
>>
>> We have the following code in the form body.
>>
>> <xh:td>
>>                                 <xf:trigger
>> id="complete-appraisal-confirm-control"
>> bind="complete-appraisal-confirm-bind">
>>                                     <xf:label
>> ref="$form-resources/complete-appraisal-confirm/label"/>
>>                                     <xf:hint
>> ref="$form-resources/complete-appraisal-confirm/hint"/>
>>                                     <xf:alert
>> ref="$fr-resources/detail/labels/alert"/>
>>                                     <xf:action ev:event="DOMActivate">
>>                                         <xf:setvalue bind="status-bind"
>> value="'sent for review'"/>
>>                                         <xf:setvalue
>> bind="show-complete-section-bind" value="'false'"/>
>>                                         <xf:send
>> submission="create-instance"/>
>>                                     </xf:action>
>>                                 </xf:trigger>
>>                             </xh:td>
>>
>>
>> And the relevant submission event in the head of the form.
>>
>>   <xf:submission id="create-instance" method="put"
>> instance="fr-form-instance"
>>                            replace="instance"
>>                            serialization="application/xml"
>>                            validate="true"
>>                            relevant="true"
>>
>> resource="http://localhost:8040/orbeonapi/crud/erdf/appraisal/data/{xxf:instance('fr-parameters-instance')/document}/data.xml">
>>                 <xf:header combine="replace">
>>                     <xf:name>Accept</xf:name>
>>                     <xf:value>application/xml</xf:value>
>>                 </xf:header>
>>                 <xf:action ev:event="xforms-submit-error">
>>                     <xf:message level="modal">
>>                         <xf:output value="'There are validation errors.
>> Please check your selections and entries, and retry once all fields have
>> been filled out.'"/>
>>                     </xf:message>
>>                 </xf:action>
>>                 <xf:action ev:event="xforms-submit-done">
>>                     <xf:setvalue
>> ref="xxf:instance('fr-persistence-instance')/data-safe-override">true</xf:setvalue>
>>                     <xf:send submission="wf-submit-appraisal"/>
>>                     <xf:load
>> resource="/esif-web/appraisal/{instance('fr-form-instance')//*:status}/for/{xxf:instance('fr-form-instance')/*:uids/*:application/string()}"/>
>>                     <!--<xf:load
>> resource="/esif-web/applications/dashboard"/>-->
>>                 </xf:action>
>>             </xf:submission>
>>
>>
>> We could have a validation error as a pop up message, but we would like to
>> have the red validation alerts to be displayed as well.
>>
>> How can we display the validation errors as the red alerts at the bottom
>> of screen which is like the default save or submit button from Orbeon form
>> builder and runner?
>>
>>
>> Could you please advise?
>>
>>
>> Thanks,
>>
>> Chunyu
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Orbeon Forms" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [hidden email].
>> To post to this group, send email to [hidden email].
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Orbeon Forms" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/orbeon/3XtpmNNPtM8/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [hidden email].
> To post to this group, send email to [hidden email].

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].