• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Multi-page form with skipping several pages

Multi-page form with skipping several pages 2 years 2 months ago #42590

  • info7567
  • info7567's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 7
  • Thank you received: 3
Hi guys,

I am creating a form with many question. Each question is shown on a single page.
Now I need to skip several pages if an option is chosen. I achieved this by using the following code as described here:
www.rsjoomla.com/support/documentation/r...multi-page-form.html

function rsfp_conditionalPage(formId, page, totalPages, validate){

if(page == 1 && document.getElementById('Thema1').checked && typeof validate != 'undefined'){
rsfp_changePage(formId, page+3, totalPages, validate);
return '';
}
if(page == 1 && document.getElementById('Thema1').checked && typeof validate == 'undefined'){
rsfp_changePage(formId, page-3, totalPages, validate);
return '';
}

rsfp_changePage(formId, page, totalPages, validate);
}

The first if clause works fine. If I choose the value Thema1 and then press the next-button, I automatically go to page 5 which is correct.
But when I press the previous button on page 5 the form only goes one page back. If I only skip one page, it works like a charm.

I also tried to change the second if clause to if(page == 5, because we are on page 5, but it doesn't work either.

Maybe someone can help me with this.
Thanks in advance

Tanja Vogt
The administrator has disabled public write access.

Multi-page form with skipping several pages 2 years 2 months ago #42593

  • info7567
  • info7567's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 7
  • Thank you received: 3
Hi guys,

I figured out myself but wanted to share the solution if someone else is struggeling with the script.

I wanted to jump to page 5 when a specific value is checked on page 1 and then go back to page one if the previous button is pressed on page 5.

The following script works. It was the wrong page in the if clause. It always has to be the page the button (previous or next) would normally go to.
So in my case, I am on page 5, which is actually page4 since the counting starts with 0. So the previous button would normally go to page 3.

function rsfp_conditionalPage(formId, page, totalPages, validate){

// for next button on page 1 (page0)
if(page == 1 && document.getElementById('Thema1').checked && typeof validate != 'undefined'){
rsfp_changePage(formId, page+3, totalPages, validate);
return '';
}
// for previous button on page 5 (page4)
if(page == 3 && document.getElementById('Thema1').checked && typeof validate == 'undefined'){
rsfp_changePage(formId, page-3, totalPages, validate);
return '';
}

rsfp_changePage(formId, page, totalPages, validate);
}

Hope this can help someone else to save some frustrating hours.
The administrator has disabled public write access.
The following user(s) said Thank You: gregs, gunerguk

Multi-page form with skipping several pages 2 years 1 month ago #42604

  • info7567
  • info7567's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 7
  • Thank you received: 3
Hi guys,

although I figured out how to implement the skipping correctly, I now face another problem.
When skipping the page, the validation check doesn't work as expected.

If I am on page 3 and skip to another page based on the value of page 1 then the required field on page 3 is not validated at all.

This is the code I used:

function rsfp_conditionalPage(formId, page, totalPages, validate){

if(page == 4 && document.getElementById('Thema0').checked && typeof validate != 'undefined'){
rsfp_changePage(formId, page, totalPages, validate);
return '';
}
else if(page == 4 && document.getElementById('Thema1').checked && typeof validate != 'undefined'){
rsfp_changePage(formId, page+1, totalPages, validate);
return '';
}
else if(page == 4 && document.getElementById('Thema2').checked && typeof validate != 'undefined'){
rsfp_changePage(formId, page+3, totalPages, validate);
return '';
}
else if(page == 4 && document.getElementById('Thema3').checked && typeof validate != 'undefined'){
rsfp_changePage(formId, page+4, totalPages, validate);
return '';
}
else if(page == 4 && document.getElementById('Thema4').checked && typeof validate != 'undefined'){
rsfp_changePage(formId, page+4, totalPages, validate);
return '';
}
rsfp_changePage(formId, page, totalPages, validate);
}


Maybe someone has an idea on that.
Tanja
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!