Login  Register

Re: Redirecting & Toggle issues

Posted by Erik Bruchez on Apr 15, 2011; 2:42am
URL: https://discuss.orbeon.com/Redirecting-Toggle-issues-tp3450828p3451138.html

Dani,

Redirection can be achieved simply with the xforms:load action.

On the toggle: XForms doesn't yet have a data-bound switch (that's
scheduled for XForms 1.2), but if what you are trying to do is show
part of the page depending on a value in the instance, you can do this
with something like this:

<xforms:group ref=".[logViz = 0]">
  ... case 1 ...
</xforms:group>
<xforms:group ref=".[logViz != 0]">
  ... case 2 ...
</xforms:group>

I hope this helps,

-Erik

On Thu, Apr 14, 2011 at 2:59 PM, D4Ni <[hidden email]> wrote:

> Hy,
>
> My name is Dani, I'm from Romania, and I'm currently working at my Licence's
> Degree which is on XForms.
> Before I'll show you my problem I want to note that I'm pretty new to XForms
> (I just started from scratch) and I'm not using Orbeon framework (I like to
> work in notepad (ConTEXT actually) because I want control to everthing i
> do), I'm using plain XForms and PHP for database interaction.
>
> My problem is with a login form. The form is complex. I use 5 types of
> users, made by selection with a select1 (no problem here).
> After I enter the information (user & password) I submit the data to a php
> and I check the database. If the credentials are wrong I return a string
> (message) to my Instance (msgViz) which is displayed as an output. Because I
> am using the replace="instance" option I can't redirect from PHP if the
> credentials are right.
>
> Is there a method to redirect using XForms?
> OR
> Is there a method to alert the user his credentials are wrong without
> returning something to the instance?
>
> The code used for this:
>
> The instance (the part for one user):
>
>
>
>
>                 vizitator
>                 vizitator
>
>
>
>
>
>
> The submission:
>
>
>
> The PHP for the wrong credentials:
>
>      $doc->getElementsByTagName("logViz")->item(0)->nodeValue = '0';
>      $doc->getElementsByTagName("pViz")->item(0)->nodeValue = '';
>      $doc->getElementsByTagName("msgViz")->item(0)->nodeValue = 'Invalid
> username or password!';
>      echo $doc->saveXML();
>      exit;
>
> The form:
>
>
>
> Vizitator:
>
>
>         Username:
>
>
>
>
>         Password:
>
>
>
>
> Login
>
>
>
>
>
>
>
>
> ----
>
> Because I didn't manage to redirect my page after I logged in, I tried to
> hide the selection and the login forms with a swith/case. The toggle works
> if I use it with an submit event, but that's not helping me because the
> credentials could be right or wrong. So my question is:
> Can a toggle be set around a value from the model instance?
>
> What I was thinking is if the logViz = 0, then I have the NotLogged case,
> and if logViz = 1, I have the Logged case. Is it possible?
>
> I've attached the whole document in xforms.rar
> I'm working at this page for a week now because of the redirection & toggle
> problems, and it's getting frustrating because my time is short. I've tried
> several solutions but nothing worked. I would really appreciate some help
> from you guys to solve this.
>
> Thanks in advance.
> http://orbeon-forms-ops-users.24843.n4.nabble.com/file/n3450828/xform.rar
> xform.rar
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Redirecting-Toggle-issues-tp3450828p3450828.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