Login Form

#654 – Navigate to multiple pages on form submit.

Posted in ‘BF Survey’
This is a public ticket. Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.
Tuesday, 07 July 2015 23:22 AEST
Kishan
Joomla! version: (3.3)

Hi Tim,


Hope you are doing f9.
After form submit is it possible to give to which page to navigate dynamically.

Our requirement is,
In BF survey page we need two submit buttons, onclick of first button, page should navigate to Thank you page. if we click second button, page should navigate to another bf survey question page.
(form should be submitted both the times and answers should be stored in db).

Is there way to implement this functionality.kindly guide me through this.

If not , what workaround i thought is to do -
on click of Submit button store that submit button Id in session , then after the data is stored in db and before navigating to next page, get the variable and navigate to required page.

For this to perform I need to know these.
1)which is the first php executed on form submit, so that I can get that variable as $_POST(ID) and store in session and
2)which page actually redirects the page to thank you page.

Kindly guide me in any of the following.

Regards,
Kishan
 
Wednesday, 08 July 2015 16:02 AEST 10'
Tim
Everything Bundle, BF Quiz Plus 3 Years, BF Survey 12 Months
Hi Kishan,
I'm going to assume you are using BF Survey version2 (not BF Survey Plus). In your survey category, there is a setting "Redirect URL", which your user will be taken to at the end of the survey instead of the Thank You page. Potentially you could have one survey feeding directly into a second survey. Or you could have an article with the thank you page, and insert a button to launch the next survey. If you want to be fancy, you can pass the username and email etc via URL from the first survey to the second one (however that might involve a few lines of code)
http://tamlynsoftware.com/products/bf-survey/bf-survey-plus-user-guide-2/pre-poplate-fields.html
Or if the user is logged in at the time of taking the survey, there is no need to pass the username and email as these will already be pre-populated.
That said, these two survey submissions would be stored separately in the respective database table in two separate records. Not sure if you are looking for a combined record with responses from both surveys, or whether individual records would be ok for what you are trying to achieve.

regards

Tim
Follow us on twitter http://twitter.com/tamlynsoftware
Wednesday, 08 July 2015 16:44 AEST
Kishan
Hey Tim ,

I think you dint get exactly what required is.

Consider there are two pages A and B and I have an BF survey question page.

I just want two submit buttons on question page like
1)"Submit and navigate to A" and 2) "Submit and navigate to B"
Onclick of "Submit and navigate to A" the page should navigate to A article
Onclick of "Submit and navigate to B" the page should navigate to B article.

I cant use the redirect URL in category because there is option to enter only one URL not two.

So Is this possible in BF survey article.



If not Kindly tell me which is the php file where you are taking BF survey form data may be something like $_POST(). or like which page exactly the <form action=""> is being submitted. So that on click i can get which submit button is clicked and that I will use to navigate.

Hope you got the requirement.



 
Wednesday, 08 July 2015 23:02 AEST 15'
Tim
Everything Bundle, BF Quiz Plus 3 Years, BF Survey 12 Months
Hi Kishan,
Ok, I think I have a better understanding of what you are trying to achieve.

The code that triggers the Redirect URL is in the file /components/com_bfsurvey/views/thankyou/tmpl/form.php

//line 43
if($result->redirectURL != "")
{
	$app->redirect( JRoute::_($result->redirectURL, false), $msg );
}

You could hack this to have multiple triggers.

What I would be doing is editing the category and adding a second redirectURL field. You would need to add a new field to your #__bfsurvey_categories table, then add the field in /administrator/components/com_bfsurvey/views/category/tmpl/form.php and /administrator/components/com_bfsurvey/views/category/tmpl/form.form.xml

You'll find the code for the submit button in the view, for example /components/com_bfsurvey/views/1result/tmpl/form.php
You could either create a template override for that specific survey, or edit the code that generates these front end files to add this second button to every survey, in which case you'd need to look at /administrator/components/com_bfsurvey/helpers/answertable.php. In particular, look at the code in the createTabbedForm function.

I hope this helps.

regards

Tim
Follow us on twitter http://twitter.com/tamlynsoftware
Thursday, 09 July 2015 15:34 AEST
Kishan
Hey Tim,


Thanks a Lot for your reply

This helped to me to navigate to different pages as required.
Only doubt I had was that even that file /components/com_bfsurvey/views/thankyou/tmpl/form.php
would be reloaded again with the back end php code like other form.php , but thanks anyway thats not happening.


Regards,
Kishan
 
Thursday, 09 July 2015 17:15 AEST 5'
Tim
Everything Bundle, BF Quiz Plus 3 Years, BF Survey 12 Months
Hi Kishan,
The thank you view is not dynamic, it won't automatically get overwritten. If you change via a template override, you will not loose your changes when you update the software version in future.

regards

Tim
Follow us on twitter http://twitter.com/tamlynsoftware
Wednesday, 12 August 2015 14:25 AEST
system
This ticket has been automatically closed. All tickets which have been inactive for a long time are automatically closed. If you believe that this ticket was closed in error, please contact us.
This ticket is closed, therefore read-only. You can no longer reply to it. If you need to provide more information, please open a new ticket and mention this ticket's number.
Go to top