Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

How to deactivate parts of the formular based on previous answers?

Avatar

Avatar
Level 1
AndreasBastgen
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
View profile

Avatar
Level 1
AndreasBastgen
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
View profile
AndreasBastgen
Level 1

20-09-2017

Hi Guys,

i have the following problem:

My goal is to a set up a formular of the following form:

Question 1:

A:  Blabalbalab

B: Blabalbalbabla

If you choose A then continue with Question 2, if you choose B then continue with question 3.

So in case the user chooses B question 2 should be skipped. I seek a way that the fields of question 2 will be automatically deactivated when the user chooses B in question 1. Basically by pressing tab the user should directly be directed to question 3 if he has choosen B in question 1.

This should be possible, right?

Anyone, who knows how to do that?

Greetings,

Andreas

Accepted Solutions (0)

Answers (2)

Answers (2)

Avatar

Avatar
Validate 1
Level 4
mouslander
Level 4

Likes

23 likes

Total Posts

298 posts

Correct Reply

27 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 4
mouslander
Level 4

Likes

23 likes

Total Posts

298 posts

Correct Reply

27 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
mouslander
Level 4

22-09-2017

do you want to protect the question if it is skipped or push the user to the appropriate question? This is a conditional response. We see this on paper forms all the time for example: if you selected "no children" skip question 3 and go to question 9. If this is the case you may want to not only lock the subsequent questions (as they are not relevant) but drive the user to the next question they need to respond to. as MinusZero has indicated you can lock the questions however once that is done, you would want to set the focus to the next question. You would need to use the setFocus function in your script xfa.host.setFocus("#field"); for example

Avatar

Avatar
Validate 1
Level 4
MinusZero
Level 4

Likes

30 likes

Total Posts

326 posts

Correct Reply

54 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile

Avatar
Validate 1
Level 4
MinusZero
Level 4

Likes

30 likes

Total Posts

326 posts

Correct Reply

54 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile
MinusZero
Level 4

20-09-2017

Hi,

You can do this easily by changing the access event for the radio buttons. I would use a table to make it easier to 'disable' a question based on the answer.

This is my result:

1302975_pastedImage_0.png

When Answer B is clicked, Question 2 is 'disabled'.

You can see below that i have set mine up with one question and answer radio buttons per row. By using a table, you can just 'disable the whole row rather than having to disable multiple items.

1302976_pastedImage_1.png

In the Q1 Answer B click event add this:

form1.#subform[0].Table1.Row1.#subform[0].RadioButtonList.#field[1]::click - (JavaScript, client) //Q1 Answer B

this.resolveNode("Row2").access = "protected"; //using protected rather than read only ensures that TAB skips the field when pressed.

Make sure you add the opposite to Q1 Answer A. If the user changes their mind, you need to re-enable Q2

form1.#subform[0].Table1.Row1.#subform[0].RadioButtonList.#field[0]::click - (JavaScript, client) //Q1 Answer A

this.resolveNode("Row2").access = "open"; //open enables the row again

The code does not send focus to Q3 when a selection is made because pressing tab will do that for you.