• 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: How to avoid a part of a form

How to avoid a part of a form 3 years 2 months ago #40915

  • rgouyon
  • rgouyon's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 24
  • Thank you received: 1
Hello
I am building a subscription multiple page form. In the first page the subscriber indicate his birth day. If he is under 18 old he had to indicate some information about his parent on the next page.
But if he is older I liked to skip the pages concerning his parents informations.
I guess I have some javascript to write but I don't know how to jump to a spécific page.
if some one has an idea
The administrator has disabled public write access.

How to avoid a part of a form 3 years 2 months ago #40917

  • iceferret
  • iceferret's Avatar
  • OFFLINE
  • Gold Boarder
  • Posts: 213
  • Thank you received: 57
If you can keep your head when all about you are losing theirs, then you obviously don't understand the situation!
The administrator has disabled public write access.

How to avoid a part of a form 3 years 2 months ago #40918

  • rgouyon
  • rgouyon's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 24
  • Thank you received: 1
Thanks I am going to see that
The administrator has disabled public write access.

How to avoid a part of a form 3 years 2 months ago #40919

  • rgouyon
  • rgouyon's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 24
  • Thank you received: 1
I did not understand every thing but it's working.
Here is my javascript code. It is testing if the subsciber is older than 18. It may helps some one
<script type="text/javascript">
function rsfp_conditionalPage(formId, page, totalPages, validate){
 
           jour=document.getElementById('fnaissanced').value;
           mois=document.getElementById('fnaissancem').value;
           annee=document.getElementById('fnaissancey').value;
 
           birthday=new Date(annee,mois,jour);
	   age= new Number((new Date().getTime() - birthday.getTime()) / 31536000000).toFixed(0);
 
	if(page == 1 && age>=18 && typeof validate != 'undefined'){
		rsfp_changePage(formId, page+1, totalPages, validate);
		return '';
	}
 
	if(page == 1 && age>=18 && typeof validate == 'undefined'){
		rsfp_changePage(formId, page-1, totalPages, validate);
		return '';
	}
	rsfp_changePage(formId, page, totalPages, validate);
}
</script>
Last Edit: 3 years 2 months ago by rgouyon.
The administrator has disabled public write access.

How to avoid a part of a form 3 years 2 months ago #40920

  • rgouyon
  • rgouyon's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 24
  • Thank you received: 1
There is a little problem with this solution. The problem is that I have lost the control of the required fields.
Even if I set the Validate when changing page attribute and set Use Ajax Validation I can jump from pages to pages without filling the required fields
The administrator has disabled public write access.

How to avoid a part of a form 3 years 2 months ago #40921

  • iceferret
  • iceferret's Avatar
  • OFFLINE
  • Gold Boarder
  • Posts: 213
  • Thank you received: 57
Can't help with this I'm afraid, just new i'd seen that script that might have helped. Better at PHP than Javascript
If you can keep your head when all about you are losing theirs, then you obviously don't understand the situation!
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!