Search…

X3 Photo Gallery Support Forums

Search…
 
User avatar
TristanJo
Experienced
Topic Author
Posts: 116
Joined: 10 Apr 2018, 02:57

Dynamic form generation based on select option

01 Jan 2023, 03:40

Hi Karl~

I want to create a dynamic form that varies depending on the selection type.

https://stackoverflow.com/questions/36386488/javascript-dynamic-form-generation-based-on-select-option


I referred to this URL, but it doesn't work.

Do you have any examples or code that I can refer to?

Snipaste_2023-01-01_17-38-35.png
Snipaste_2023-01-01_17-38-35.png (35.12 KiB) Viewed 10575 times
Snipaste_2023-01-01_17-39-28.png
Snipaste_2023-01-01_17-39-28.png (96.51 KiB) Viewed 10575 times
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13993
Joined: 30 Sep 2006, 03:37

Re: Dynamic form generation based on select option

01 Jan 2023, 04:08

How many levels of dynamic options to do you need though? Only one? You can use javascript to display <div> based on the selected element, but it gets complicated if it's more than one level. I can't just write something like that on short notice.

There is another post here:
https://stackoverflow.com/questions/599 ... down-value

For complex forms, external form builders can be used. Like https://docs.google.com/forms or https://www.jotform.com/.

If I am to write something like that for you, I would need to charge something like $10.
 
User avatar
TristanJo
Experienced
Topic Author
Posts: 116
Joined: 10 Apr 2018, 02:57

Re: Dynamic form generation based on select option

01 Jan 2023, 04:54

mjau-mjau wrote: How many levels of dynamic options to do you need though? Only one? You can use javascript to display <div> based on the selected element, but it gets complicated if it's more than one level. I can't just write something like that on short notice.

There is another post here:
https://stackoverflow.com/questions/599 ... down-value

For complex forms, external form builders can be used. Like https://docs.google.com/forms or https://www.jotform.com/.

If I am to write something like that for you, I would need to charge something like $10.
OK! Please Karl~

I attach a diagram.

Is it complicated? :kissing_heart:
Snipaste_2023-01-01_18-54-16.png
Snipaste_2023-01-01_18-54-16.png (94.97 KiB) Viewed 10572 times
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13993
Joined: 30 Sep 2006, 03:37

Re: Dynamic form generation based on select option

01 Jan 2023, 05:10

As far as I can see in that diagram, you only have one dynamic "select" option at the top? Basically you create all the "select X" elements, hide them all, then display them depending on Select. It would require some javascript and CSS of course.

If you create all the elements first, I can make the javascript for you.
 
User avatar
TristanJo
Experienced
Topic Author
Posts: 116
Joined: 10 Apr 2018, 02:57

Re: Dynamic form generation based on select option

01 Jan 2023, 05:40

mjau-mjau wrote:you only have one dynamic "select" option at the top?
Yes



mjau-mjau:
Basically you create all the "select X" elements, hide them all, then display them depending on Select
Select 0 : Choose
Can't make form 1(Select 1) show by default?


mjau-mjau:
If you create all the elements first, I can make the javascript for you.
Should I make one first?
then
After creating several contact pages, I will tell you

(I thought that once the basic framework was created, it would be fine to fix it in detail.)
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13993
Joined: 30 Sep 2006, 03:37

Re: Dynamic form generation based on select option

01 Jan 2023, 09:11

TristanJo wrote: Can't make form 1(Select 1) show by default?[/b]
Can.
TristanJo wrote:Should I make one first?
then
After creating several contact pages, I will tell you

(I thought that once the basic framework was created, it would be fine to fix it in detail.)
Ok, I created a basic framework below. You should be able to figure it out ...
https://jsbin.com/sejosupiqo/edit?html,css,js,output
 
User avatar
TristanJo
Experienced
Topic Author
Posts: 116
Joined: 10 Apr 2018, 02:57

Re: Dynamic form generation based on select option

01 Jan 2023, 12:07

mjau-mjau wrote:
TristanJo wrote: Can't make form 1(Select 1) show by default?[/b]
Can.
TristanJo wrote:Should I make one first?
then
After creating several contact pages, I will tell you

(I thought that once the basic framework was created, it would be fine to fix it in detail.)
Ok, I created a basic framework below. You should be able to figure it out ...
https://jsbin.com/sejosupiqo/edit?html,css,js,output
It's perfect. :thumbsup::thumbsup::thumbsup:

thank you karl~

Please send me the invoice.
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13993
Joined: 30 Sep 2006, 03:37

Re: Dynamic form generation based on select option

01 Jan 2023, 22:03

Good! I won't need to charge anything.
 
User avatar
TristanJo
Experienced
Topic Author
Posts: 116
Joined: 10 Apr 2018, 02:57

Re: Dynamic form generation based on select option

02 Jan 2023, 01:47

mjau-mjau wrote: Good! I won't need to charge anything.
Wow~
Thank you~ very much~ karl~
Happy new year~:heart_eyes: