Good evening, I know that this particular question has already an answer, for example here: https://www.chronoengine.com/forums/topics/view/111163/how-to-skip-a-page#p403346
But I can't get it to work. I have 2 buttons:
and in the Submit of this page there is the PHP:
and then the NextPage action:
I hit the "Back" button, in the debug there is the following data:
but it goes forward. Where is my error? Thank you very much.
you should use this code, you need to check if the data exists or not:
if(isset($this->data["button_back"]))
Thank you very much for your reply, the code works, but if I go back and then, when in that page again, I press "Next" button, I go backward.
This is because the data are maintained on changing page, this is the debug:
As you can see, both buttons are present (even if the button_back was not pressed now, only before), and the first one wins.
Yes, because data is stored in the session till the form is finished
You may use a Link as the back button, the link href should be the form URL + &chronopage=page-alias, this is explained here:
https://www.chronoengine.com/faqs/chronoforms/chronoforms8/how-to-create-a-multi-page-form-in-chronoforms8
to make the link look like a button, add the class = nui button
Thank you again, now all works as desired.
The problem now is the style: with this class="nui button colored green left iconed" in the "a" tag (first button) I obtain this:
The desired style should look as this instead:
It's very difficult for me to obtain the correct look like that of a button. Will be possible (even in a future release) to have a button acting like an "a" tag?
Thank you very much.
Sorry, I forgot to tell you that the button view has "Button type" setting which can be set to "Previous page link", you can see it in action if you import the "Multipage form" from the demo forms included in the v8 installer:
Yes, thank you, but my problem is, if I use "previous page link" I can only go back to previous page and not for example go back two pages. That's why I asked you the possibility to set the page, otherwise I don't know how to solve my problem.
ok, so do it your way but check the code of that back button and make your link look the same, does this solve your problem ?
You are right, thank you. I looked at the code and tried this solution:
but the PHP section is ignored. I don't know if I can use php this way, like you used it in your code.
how did you build your button earlier at this post:
?
just use the same code along with the class "left iconed", if you need to add an icon then use {icon:arrow-left}, do not use PHP for that
Thank you very much, works well.
You confirm that there isn't a way to find which button is pressed, as data is stored in the session till the form is finished.
Thank you again.
you may check the $_POST array for buttons, this is the fresh post values and will not be affected by the form session