Custom form question


(Alderman) #1

I have seen other queries here like the one I am about to ask but they seem to have been back in 2010/2011.

 

Is it possible to present different sections of a form based on prior question answers?  Previous answers here suggest it would have to be done via javascript - is this still the case?  That would be a shame as we can do that kind of thing easily in our Wordpress platform but have chosen Squiz as our corporate CMS.

 

Thanks,

 

Jeff.


(Alderman) #2

I see that a paint layout could be applied - would paint layout logical conditions do what we want?  Also in Squiz 5 does the expansion of logical conditions to containers in assets apply to form components?


(Anthony Barnes) #3

It depends on what you are trying to achieve with the form. Many times we find clients wish to simply dynamically display additional fields on a single page form without reloading the page, meaning that custom javascript is an appropriate choice. If you goal is to direct the user to a series of questions you can try the decision tree asset: http://manuals.matrix.squizsuite.net/other-cms-assets/chapters/decision-tree


(Bart Banda) #4

If you are wanting to display dynamic content on the same page as the user interacts with the form, you have to use JavaScript, Wordpress would be using JS for this as well. 

 

If you are happy to just do it on the next page of the form, you can use keyword modifiers to show/hide sections based on the answers from the previous page. For example:

%response_1234_q1^eq:Yes:SHOW:HIDE%

(Alderman) #5

Thanks for the responses guys - much appreciated.  I think Bart's answer is nearest to what we want to do which is something like..

 

if section 1 question 3's response was 'yes' (or whatever) then jump straight to section 4 and don't show sections 2 and 3 

 

As for Wordpress we use a plugin called formidable forms which shows/hides questions/sections based on combinations of previous answers.  If it's using js then it hides that from the form creation interface.


(Tbaatar) #6

 

If you are wanting to display dynamic content on the same page as the user interacts with the form, you have to use JavaScript, Wordpress would be using JS for this as well. 

 

If you are happy to just do it on the next page of the form, you can use keyword modifiers to show/hide sections based on the answers from the previous page. For example:

%response_1234_q1^eq:Yes:SHOW:HIDE%

 

Hi Bart,

 

Is it possible to show or hide form with multiple sections? It seems the following keyword is for the final confirmation/thank you page.

 

I'm trying to to show different options based on the users previous selection. Here is an example:

 

Section 1: Select a Location (UK, Paris, Berlin or Barcelona)

Section 2: Prices and offering vary depending on the Location selected in section 1. 

 

I have tried the Decision Tree but it does not offer validation rules and not enough flexibility with values, and difficult to calculate to Final Price.

 

 

Thanks.


(Bart Banda) #7

Yea you can do it on a section as well, if you are using multiple pages, the response keywords work anywhere actually as long as they have some POST data in them. 

 

For example, you could print this on the second page of your form to conditionally print the contents of a form field based on a previous answer:

%response_1111_q1^replace_keywords:eq:1:{question_contents_2222_q1}:%

Or in your case you might use something like:

%response_1111_q1^replace_keywords:contains:UK:{question_contents_2222_q1}:%

(Alderman) #8

Cheers Bart.  That looks ideal for us too.


(Tbaatar) #9

Thanks Bart.

 

Feeling bit numb today so really sorry for asking the obivious, but where would you place the responses if you only have a single type format? 


(Bart Banda) #10

Hey tbaatar, sorry for late reply.

 

What do you mean by "if you only have a single type format" ?

 

Do you mean you only use the form contents bodycopy format and only have 1 page of form fields and you want to do conditional sections? 


(Pomster09) #11

It's pretty simple to show and hide even content on quite complex forms using simple JS. Check this form I did last year that is a single page form that I've split into a tabbed format using simple JS show/hide. Plus other fields are either shown or hidden based on user selection.

 

http://www.vwa.vic.gov.au/safety-and-prevention/registration-and-notification/notification-of-asbestos-removal/asbestos-notification/asbestos-notification


(Adeline Yaw) #12

 

Yea you can do it on a section as well, if you are using multiple pages, the response keywords work anywhere actually as long as they have some POST data in them. 

 

For example, you could print this on the second page of your form to conditionally print the contents of a form field based on a previous answer:

%response_1111_q1^replace_keywords:eq:1:{question_contents_2222_q1}:%

Or in your case you might use something like:

%response_1111_q1^replace_keywords:contains:UK:{question_contents_2222_q1}:%

 

Hi Bart,

 

I have a similar problem with forms. I'm using a tickbox list question and would like questions to appear based on users selection. Is using the above conditions applicable to questions using a tickbox list or even option lists? If it helps, the form I've created is one page and not a multi page form.

 

Thanks,

Adeline


(Adeline Yaw) #13

It's pretty simple to show and hide even content on quite complex forms using simple JS. Check this form I did last year that is a single page form that I've split into a tabbed format using simple JS show/hide. Plus other fields are either shown or hidden based on user selection.

 

http://www.vwa.vic.gov.au/safety-and-prevention/registration-and-notification/notification-of-asbestos-removal/asbestos-notification/asbestos-notification

 

Hi Wardy,

 

I'm interested to see what you've done but I don't have access to view this page or it's not publicly accessible...

 

Cheers,

Adeline


(Bart Banda) #14

 

Hi Bart,

 

I have a similar problem with forms. I'm using a tickbox list question and would like questions to appear based on users selection. Is using the above conditions applicable to questions using a tickbox list or even option lists? If it helps, the form I've created is one page and not a multi page form.

 

Thanks,

Adeline

 

If you are wanting to do it all on the same page, you will need to use JavaScript to handle that, such as what Wardy suggested.  


(H Cannon) #15

Yes, that’s what I am looking for so I am interested in seeing your form. However it goes into a Squiz log in box.


(tina ye) #16

Hi Bart,

I am working on the same problem on Squiz Matrix v.5.4.2.0 - presenting different sections of a form based on prior question answers.
Could I please ask a dumb question - with multiple page forms, there is ONLY ONE page content layout where I could use the %current_page_contents% keyword or spell out all the questions and question fields for different contents of the sections of the form. Where is the “second page” you were talking about in the above thread that you posted back in Aug 2014? I have tried something similar to %response_1111_q1^replace_keywords:contains:UK:{question_contents_2222_q1}:% but because I had nested sections of questions in the form based on prior question answers and I had to click the submit or save button multiple times to move forward which isn’t good for the users.
I have tried to put different section contents in separate raw html content containers divs in Page Contents of the form but it didn’t work either.

Thanks for your help!
Tina