Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditional form fields #372

Open
AlexAlbersNL opened this issue Nov 22, 2023 · 2 comments
Open

Conditional form fields #372

AlexAlbersNL opened this issue Nov 22, 2023 · 2 comments

Comments

@AlexAlbersNL
Copy link

Q A
Bug? no
New Feature? yes
Bundle Version Specific version or SHA of a commit
Sulu Version Specific version or SHA of a commit
Browser Version Browser name and version

Actual Behavior

You can use dropdown form fields with multiple answer possibilities. However, in the back-end it is not possible to have follow up questions depending on the answer given in a previous dropdown question.

Expected Behavior

A conditional form field that is only shown in the front-end for the user to fill in, when a specific option is selected in a previous/referred dropdown form field.

Steps to Reproduce

Question 1: What color do you like most?
Options: Red | Blue | Orange | Yellow

Conditional form field:
If Question 1 = Orange
Question 1A: What is your most favorite orange item?

@alexander-schranz
Copy link
Member

That sure an interesting Idea but I'm not sure if the SuluFormBundle is the right fit for this kind of complex forms. As such forms goes into direction of Wizards. And what the SuluFormBundle is not build for is to create forms for Business Logic. It is more the quick content manager forms for Contact Us, Help Desk, ... .

If the Form represent Business Logic it should be part of the Code and not a form managed by content manager.

Keep still in mind the SuluFormBundle is at the end just a Symfony Form and there as nothing which has more hooks and events to hook into then the symfony/form component. And you could so still create such things in a project or put it into a bundle as an extension.

What kind of forms do you want to create? And what is happening with the submitted data over this kind of forms?

@AlexAlbersNL
Copy link
Author

Hi Alexander. Thanks for the reply. I wish I could program, but I'm just an end-user with no coding skills (though, I must admit I can understand HTML a bit.....cough). ;-)

I desperately need this functionality in the forms I create in the back-end. Unfortunately, conditional form fields aren't available. They come in very handy to keep your forms short, presentable and logical. Hiding questions that are irrelevant for the visitors of our website, will make the forms less complex to fill out. Here is a form I now configured together in the back-end: https://www.eurol.com/en/lube-check

Scroll down to the Equipment part. You'll see a question in where is asked to select the equipment part. Then a bunch of follow-up questions are already visible, while only one of them is relevant (depending on the answer given in the Equipment part question). And it should be required to because it is vital information for us, but I can't make them required now. This is because only one of them is possible for the visitor to answer. So now I need to notify the user in advance to only answer the follow-up question that is applicable for them, which is a hideous situation and sensitive to errors.

Again, I'm not a programmer. Just dropping this feature request as an end-user, hoping it will come available in the future. :-) Don't know this is the place to do this. If not, then sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants