Login  Register

Re: Re: Re: Redirecting & Toggle issues

Posted by Erik Bruchez on Apr 19, 2011; 4:20am
URL: https://discuss.orbeon.com/Redirecting-Toggle-issues-tp3450828p3459404.html

This one is not correct XPath and also would point to the wrong node:

instance('vizInst')/viz.[logViz = 'false']

Try:

instance('vizInst')[logViz = 'false']

Although it seems like logViz should compare to '0' or '1', not 'false', right?

-Erik

On Sat, Apr 16, 2011 at 12:43 AM, D4Ni <[hidden email]> wrote:

> First of all Thanks for the respones.
>
> @Redirection:
> This is interesting. But how do the condition work? I have to use a function
> or can I use a value?
>
> <xf:instance id="vizInst">
>      <dataViz xmlns="">
>            <viz>
>                 <uViz>vizitator</uViz>
>                 <pViz>vizitator</pViz>
>                 <msgViz/>
>                 <logViz>0</logViz>
>                 <contViz/>
>           </viz>
>      </dataViz>
>      </xf:instance>
>
> I binded the logViz from the instance as a decimal.
>
> <xf:bind nodeset="instance('vizInst')/viz/logViz" type="xs:decimal" />
>
> In th PHP if the credentials are right i return logViz = 1 else logViz = 0
>
> so i made this action:
>
> <xf:action ev:event="xforms-submit-done" if="instance('vizInst')/viz/logViz
> = 1" resource="http://www.google.com"/>
>
> It is correct? Because it doesn't work. I don't know how to write the
> condition.
>
> I also tried this:
>
>  <xf:action ev:event="xforms-submit-done"
> if="instance('vizInst')/viz/.[logViz = 1]"
> resource="http://www.google.com"/>
>
> If i make the redirection I don't need the toggle to hide the form, and that
> would be great. I tried several actions to the logViz like setvalue for
> exemple, but it didn't work, i'm doing something wrong. How can I do a
> little debugging around an instance value?
>
> @Toggle:
> I have two cases(for now): NotLogged (showing the select1 and the login
> forms for each value of the select1) and Logged (showing a message)
>
> Before I wrote here i tried this:
>
> <xf:submission id="loginV" method="post" action="loginV.php"
> ref="instance('vizInst')" replace="instance" targetref="instance('vizInst')"
> />
>      <xf:action ev:observer="loginV" ev:event="xforms-submit">
>        <xf:toggle case="Logged" />
>      </xf:action>
> And it worked. But I understand now that I need a condition and the
> xforms-submit-done event maybe.
>
> After your response I tried to do this:
>
> <xf:switch>
>    <xf:case id="NotLogged">
>  <xf:group ref="instance('vizInst')/viz.[logViz = 'false']"> //or 0
>          case 1 (select1 and login forms)
>  </xf:group>
> </xf:case>
>
> <xf:case id="Logged">
>  <xf:group ref=".[logViz != 'true']"> //or 1
>  <p> You are logged </p>  //case 2
> </xf:group>
> </xf:case>
> </xf:switch>
>
> But i'm not using the toggle anymore. Just the code above. I thought the
> control of the cases are within the logViz... what am I doing wrong? I want
> to learn :).
>
> Now in the first case I have several groups beyond the big one i'm using for
> the case. Could that be the problem?
>
> The entire code (cases):
>
>
> <xf:switch>
>    <xf:case id="NotLogged">
>  <xf:group ref=".[logViz = 'false']">
>
>
> <xf:select1 ref="instance('usrInst')/user">
>   <xf:label>Alege tipul de user: </xf:label>
>
>   <xf:choices>
>      <xf:label>Drepturi normale</xf:label>
>
>      <xf:item>
>               <xf:label>Vizitator</xf:label>
>               <xf:value>1</xf:value>
>      </xf:item>
>
>      <xf:item>
>               <xf:label>Student</xf:label>
>               <xf:value>2</xf:value>
>      </xf:item>
>
>      <xf:item>
>               <xf:label>Profesor</xf:label>
>               <xf:value>3</xf:value>
>      </xf:item>
>
>      <xf:item>
>               <xf:label>Secretar</xf:label>
>               <xf:value>4</xf:value>
>      </xf:item>
>
>   </xf:choices>
>
>   <xf:choices>
>      <xf:label>Drepturi Speciale</xf:label>
>
>      <xf:item>
>               <xf:label>Administrator</xf:label>
>               <xf:value>5</xf:value>
>      </xf:item>
>
>   </xf:choices>
> </xf:select1>
>
> <br />
> <br />
>
>
>
>
> <xf:group ref="instance('vizInst')/viz">
> <fieldset class="fviz">
> <legend>Vizitator:</legend>
> <p class="inp">
> <xf:input ref="uViz">
>         <xf:label>Username: </xf:label>
> </xf:input>
> </p>
> <p class="inp">
> <xf:secret ref="pViz">
>         <xf:label>Password: </xf:label>
> </xf:secret>
> </p>
> <p class="inp">
> <xf:submit submission="loginV">
> <xf:label>Login</xf:label>
> </xf:submit>
> </p>
> <p>
> <xf:output class="msg" ref="msgViz" />
> </p>
> </fieldset>
> </xf:group>
>
>
>
>
> <xf:group ref="instance('studInst')/stud">
> <fieldset class="fstud">
> <legend>Student:</legend>
> <p class="inp">
> <xf:input ref="uStud">
>         <xf:label>Username: </xf:label>
> </xf:input>
> </p>
> <p class="inp">
> <xf:secret ref="pStud">
>         <xf:label>Password: </xf:label>
> </xf:secret>
> </p>
> </fieldset>
> </xf:group>
>
>
>
>
> <xf:group ref="instance('profInst')/prof">
> <fieldset class="fprof">
> <legend>Profesor:</legend>
> <p class="inp">
> <xf:input ref="uProf">
>         <xf:label>Username: </xf:label>
> </xf:input>
> </p>
> <p class="inp">
> <xf:secret ref="pProf">
>         <xf:label>Password: </xf:label>
> </xf:secret>
> </p>
> </fieldset>
> </xf:group>
>
>
>
>
> <xf:group ref="instance('secInst')/sec">
> <fieldset class="fsec">
> <legend>Secretar:</legend>
> <p class="inp">
> <xf:input ref="uSec">
>         <xf:label>Username: </xf:label>
> </xf:input>
> </p>
> <p class="inp">
> <xf:secret ref="pSec">
>         <xf:label>Password: </xf:label>
> </xf:secret>
> </p>
> </fieldset>
> </xf:group>
>
>
>
>
> <xf:group ref="instance('admInst')/admin">
> <fieldset class="fadm">
> <legend>Administrator:</legend>
> <p class="inp">
> <xf:input ref="uAdm">
>         <xf:label>Username: </xf:label>
> </xf:input>
> </p>
> <p class="inp">
> <xf:secret ref="pAdm">
>         <xf:label>Password: </xf:label>
> </xf:secret>
> </p>
> </fieldset>
> </xf:group>
>
> </xf:group>
> </xf:case>
>
>
> <xf:case id="Logged">
> <xf:group ref=".[logViz != 'true']">
> <p> You are logged !!!</p>
> </xf:group> -->
> </xf:case>
> </xf:switch> -->
>
> Thanks in advance.
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Redirecting-Toggle-issues-tp3450828p3453677.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws