Forums

Wizard like forms

Sweder 09 Feb, 2009
Hello,

I try to split-up a single form in several pages to get a wizard-like behaviour. Please see http://chronoengine.com/forums.html?cont=posts&f=2&t=12388 for background on creating multiple pages out of 1 form.

I use the code below to check which button was pressed.


<?php
$submit = JRequest::getVar('submit', '', 'post');
if ( $submit == 'Previous' ) {
  $page--;
  JRequest::setVar('page' , 'post' );
}
?>


Since I have a 'Previous' button on each page, this code no longer works. Can I check on id from the <INPUT type=submit id=button_2 value=Previous> tag?
If so, please provide a small code example.

Thanks you in advance.

Kind regards,

Sweder
GreyHead 09 Feb, 2009
Hi Sweder,

You can't check the id of a submit button that way but you can put a hidden field on each tab with a distinct value and check that.
<input type='hidden' name='page_number' value='2' />


Bob
Sweder 15 Feb, 2009
Hi,

I'm not sure how the hidden field (which I already have) helps me in identifying which button was pressed.

Anyway, I can seem to get it working. Does someone has a example of a three page form with next and prev buttons that allow to move back and forth from page to page?

Any help appriciated.

Regards,

Sweder
Sweder 15 Feb, 2009
I found a topic called "please help a girl in over her head!". I downloaded the 2step_form example. I will study the code. It looks as if it does what I am looking for.

Regards,

Sweder
This topic is locked and no more replies can be posted.