Conditional Execution of Submission

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

Conditional Execution of Submission

tatikonda
Hi,

I am trying to execute an event at Submission, only if the specified condition is true.  Condition is specified with if statement in the xforms:action statement.  Below is the sample code.  This is not working, event is fired even if the condition is false.  Can any one please help me in doing this.

************************************************************
<xforms:submit submission="sbmGo" replace="instance" tabindex="203">
  <xforms:action ev:event="DOMActivate" if="instance('insUserAccessPrivileges')/eCH:HasAuthority=1">
  </xforms:action>
  <xforms:label>Open PBD</xforms:label>
</xforms:submit>
************************************************************
 
Regards,
Shashi
Reply | Threaded
Open this post in threaded view
|

Re: Conditional Execution of Submission

RajaM-2
On Oct 20, 11:23 am, tatikonda <[hidden email]> wrote:

> Hi,
>
> I am trying to execute an event at Submission, only if the specified
> condition is true.  Condition is specified with if statement in the
> xforms:action statement.  Below is the sample code.  This is not working,
> event is fired even if the condition is false.  Can any one please help me
> in doing this.
>
> ************************************************************
> <xforms:submit submission="sbmGo" replace="instance" tabindex="203">
>   <xforms:action ev:event="DOMActivate"
> if="instance('insUserAccessPrivileges')/eCH:HasAuthority=1">
>   </xforms:action>
>   <xforms:label>Open PBD</xforms:label>
> </xforms:submit>
> ************************************************************
>
> Regards,
> Shashi
>
> --
> View this message in context:http://old.nabble.com/Conditional-Execution-of-Submission-tp30006978p...
> Sent from the Mozilla - XForms mailing list archive at Nabble.com.

Hi Shashi !!!!

this kind of situation, u can use trigger instead of submit. and one
more thing, your submit have correct attribute in wrong place. submit
control have only submission attribute  and submission element have
replace and other things. ok

by
Rajamani marimuthu
XRX Team(Lead)
_______________________________________________
dev-tech-xforms mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-xforms
Reply | Threaded
Open this post in threaded view
|

Re: Conditional Execution of Submission

tatikonda
In reply to this post by tatikonda
Hi,

I got a workaround for this.  I added a constraint on HasAuthority in the model definition.

<xforms:bind nodeset="instance('insUserAccessPrivileges')/eCH:HasAuthority" required="true()" type="xs:string" />

Submit is changed to as follows:
  1. Removed if statement
  2. Added xforms:setvalue

<xforms:submit submission="sbmGo" replace="instance" tabindex="203">
  <xforms:action ev:event="DOMActivate" >
    <xforms:setvalue ref="instance('insUserAccessPrivileges')/eCH:HasAuthority" value="if(instance('insUserAccessPrivileges')/eCH:HasAuthority=1, ., '')"/>
  </xforms:action>
  <xforms:label>Open PBD</xforms:label>
</xforms:submit>

This way submission will not be allowed if HasAuthority is not equal to 1.

Regards,
Shashi

tatikonda wrote
Hi,

I am trying to execute an event at Submission, only if the specified condition is true.  Condition is specified with if statement in the xforms:action statement.  Below is the sample code.  This is not working, event is fired even if the condition is false.  Can any one please help me in doing this.

************************************************************
<xforms:submit submission="sbmGo" replace="instance" tabindex="203">
  <xforms:action ev:event="DOMActivate" if="instance('insUserAccessPrivileges')/eCH:HasAuthority=1">
  </xforms:action>
  <xforms:label>Open PBD</xforms:label>
</xforms:submit>
************************************************************
 
Regards,
Shashi