Combobox Condition

Issues related to forms.
petejos
 
 
Posts: 155
Joined: Wed Aug 22, 2012 11:43 am

Combobox Condition

Post by petejos »

hi there,

I need to create a combobox with multiple selection of number of participants. When a user select the number from the combobox, I want a correct number of edit box to show. For example, if a user select 5 participants from the combobox, then 4 edit boxes will display below it for user to complete the names according to the number of participants they selected. I tried to set conditions in the combobox, but no luck. Please advise what should i do? Thanks.
User avatar
Pablo
 
Posts: 21578
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Combobox Condition

Post by Pablo »

You should be able to do this with conditions.

Related tutorial:
http://wysiwygwebbuilder.com/conditions.html
petejos
 
 
Posts: 155
Joined: Wed Aug 22, 2012 11:43 am

Re: Combobox Condition

Post by petejos »

Pablo wrote: Mon Sep 17, 2018 8:53 am You should be able to do this with conditions.

Related tutorial:
http://wysiwygwebbuilder.com/conditions.html
Hi pablo,

I m not after calculation. I need the numbers of editboxes to appear to user base on their choice
User avatar
Pablo
 
Posts: 21578
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Combobox Condition

Post by Pablo »

You can also use conditions to show/hide other objects based on the selected value.
Alternative, you can use events. But then you will need to add custom code to implement the conditions.
petejos
 
 
Posts: 155
Joined: Wed Aug 22, 2012 11:43 am

Re: Combobox Condition

Post by petejos »

Pablo wrote: Mon Sep 17, 2018 9:25 am You can also use conditions to show/hide other objects based on the selected value.
Alternative, you can use events. But then you will need to add custom code to implement the conditions.
I tried but no success. .

I created the following.
I have selection of 1, 2, 3. When user select 3, I want 3 edit boxes to appear so the user could enter. If user then select 2 then only edit boxes appear. Could you please give me some advise how to assign the conditions. Thanks.
User avatar
Pablo
 
Posts: 21578
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Combobox Condition

Post by Pablo »

I'm sorry, I do not have a standard solution for this. This will require a script.
In the next update I will add support for different actions with the same value.
WWBman
 
 
Posts: 916
Joined: Fri Jan 08, 2010 6:10 pm

Re: Combobox Condition

Post by WWBman »

If you've only got a few options e.g. 3, you could use a list of Radio Buttons and for each one use Events > Add > onclick > show > target editbox(es).
E.g. Radio Button 3 would have 3 show events - Editbox1, Editbox2 and Editbox3
You might want a 0 Radio Button to clear all 3 editboxes by using 3 Hides e.g.
Just an idea.

EDIT:
DOH! Just realised you can do it with a Combobox using the built-in conditions as Pablo said.
petejos
 
 
Posts: 155
Joined: Wed Aug 22, 2012 11:43 am

Re: Combobox Condition

Post by petejos »

WWBman wrote: Mon Sep 17, 2018 10:51 am If you've only got a few options e.g. 3, you could use a list of Radio Buttons and for each one use Events > Add > onclick > show > target editbox(es).
E.g. Radio Button 3 would have 3 show events - Editbox1, Editbox2 and Editbox3
You might want a 0 Radio Button to clear all 3 editboxes by using 3 Hides e.g.
Just an idea.

EDIT:
DOH! Just realised you can do it with a Combobox using the built-in conditions as Pablo said.
I can get it to show depend on the choices. But i can't hide when different choices is made. For example. After you selected 4, 4 editboxes appear then you decided to change your choice to 3, it still showig 4 edit boxes.
WWBman
 
 
Posts: 916
Joined: Fri Jan 08, 2010 6:10 pm

Re: Combobox Condition

Post by WWBman »

On the 3 event did you hide editbox4?
petejos
 
 
Posts: 155
Joined: Wed Aug 22, 2012 11:43 am

Re: Combobox Condition

Post by petejos »

The following are the conditions i have set

no selection hide AdultName1
no selection hide AdultName2
no selection hide AdultName3
no selection hide AdultName4

Showing Adult Name 1
equal to (choice) Show AdultName1

Showing Adult Name 2
equal to Show AdultName1
equal to (choice) Show AdultName2

Showing Adult Name 3
equal to Show AdultName1
equal to Show AdultName2
equal to (choice) Show AdultName3

Showing Adult Name 4
equal to Show AdultName1
equal to Show AdultName2
equal to Show AdultName3
equal to (choice) Show AdultName4
WWBman
 
 
Posts: 916
Joined: Fri Jan 08, 2010 6:10 pm

Re: Combobox Condition

Post by WWBman »

If you want the user to be able to click e.g. 3 after they have already clicked 4 then you will have to add events to Hide option editbox4 e.g.
BTW I'm not sure what the difference is between "Equal to" and "Equal to (choice)" but I don't think it's relevant here anyway.
petejos
 
 
Posts: 155
Joined: Wed Aug 22, 2012 11:43 am

Re: Combobox Condition

Post by petejos »

WWBman wrote: Mon Sep 17, 2018 11:46 am If you want the user to be able to click e.g. 3 after they have already clicked 4 then you will have to add events to Hide option editbox4 e.g.
BTW I'm not sure what the difference is between "Equal to" and "Equal to (choice)" but I don't think it's relevant here anyway.
Still doesn't work. anyone has any idea why it can't hide when different selection is made?
User avatar
Pablo
 
Posts: 21578
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Combobox Condition

Post by Pablo »

Still doesn't work. anyone has any idea why it can't hide when different selection is made?
Because currently you can only have one action per choice. So, when using the same value multiple times, the next choice will undo the previous choice.
In the next update (planned for later this year) you will be able to use multiple conditions with the same value.
petejos
 
 
Posts: 155
Joined: Wed Aug 22, 2012 11:43 am

Re: Combobox Condition

Post by petejos »

Pablo wrote: Mon Sep 17, 2018 12:14 pm
Still doesn't work. anyone has any idea why it can't hide when different selection is made?
Because currently you can only have one action per choice. So, when using the same value multiple times, the next choice will undo the previous choice.
In the next update (planned for later this year) you will be able to use multiple conditions with the same value.
Thanks Pablo. Would you be able to suggest me an alternative solutions for now?
WWBman
 
 
Posts: 916
Joined: Fri Jan 08, 2010 6:10 pm

Re: Combobox Condition

Post by WWBman »

It works with Radio Buttons but not (currently) for Comboboxes.
E.g. http://www.mediafire.com/file/as7v9n29p ... s.wbs/file
@petejos, are you using Radio Buttons or Comboboxes?
User avatar
Pablo
 
Posts: 21578
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Combobox Condition

Post by Pablo »

Would you be able to suggest me an alternative solutions for now
The only alternative I can think of, is using events as described by WWBman
petejos
 
 
Posts: 155
Joined: Wed Aug 22, 2012 11:43 am

Re: Combobox Condition

Post by petejos »

WWBman wrote: Mon Sep 17, 2018 12:23 pm It works with Radio Buttons but not (currently) for Comboboxes.
E.g. http://www.mediafire.com/file/as7v9n29p ... s.wbs/file
@petejos, are you using Radio Buttons or Comboboxes?
I am using combo boxes. What would you recommend.
WWBman
 
 
Posts: 916
Joined: Fri Jan 08, 2010 6:10 pm

Re: Combobox Condition

Post by WWBman »

As Pablo says you can only have one action per choice in a Combobox, but in the next update (planned for later this year) you will be able to use multiple conditions with the same value.
Have you downloaded my test project? It uses Radio Buttons and seems to do what you want.
http://www.mediafire.com/file/as7v9n29p ... s.wbs/file
petejos
 
 
Posts: 155
Joined: Wed Aug 22, 2012 11:43 am

Re: Combobox Condition

Post by petejos »

WWBman wrote: Tue Sep 18, 2018 7:41 am As Pablo says you can only have one action per choice in a Combobox, but in the next update (planned for later this year) you will be able to use multiple conditions with the same value.
Have you downloaded my test project? It uses Radio Buttons and seems to do what you want.
http://www.mediafire.com/file/as7v9n29p ... s.wbs/file
Yeap, I downloaded your project. Thanks. I guess I just have to use that method for now. Thanks.
WWBman
 
 
Posts: 916
Joined: Fri Jan 08, 2010 6:10 pm

Re: Combobox Condition

Post by WWBman »

It's just occurred to me that when you click e.g. 2 after clicking 3 (and filling in 3) then although the editbox will be hidden the entry for 3 will still be sent in the email so I've added a bit of Javascript (in Page HTML) to clear the relevant boxes.
So I would download the project again to get the improved version.
petejos
 
 
Posts: 155
Joined: Wed Aug 22, 2012 11:43 am

Re: Combobox Condition

Post by petejos »

WWBman wrote: Tue Sep 18, 2018 9:03 am It's just occurred to me that when you click e.g. 2 after clicking 3 (and filling in 3) then although the editbox will be hidden the entry for 3 will still be sent in the email so I've added a bit of Javascript (in Page HTML) to clear the relevant boxes.
So I would download the project again to get the improved version.
I think I found a solution for now. I insert the editboxes in layout grids. Meaning if I need to have 5 choice, 1st layout grid will have 1 edit box, 2nd layout grid will be 2 edit boxes, etc. until 5 layout grids are created. Then then send the condition in combobox.

www.goec.com.au/goec2/page3.php

I tested and it work for me so far. Any comment?
WWBman
 
 
Posts: 916
Joined: Fri Jan 08, 2010 6:10 pm

Re: Combobox Condition

Post by WWBman »

Did you test the scenario I mentioned in my previous post?
I.e. the user fills in e.g. 5 boxes and then changes their mind and changes to e.g. 3 boxes.
Were boxes 4 and 5 excluded in the email?
petejos
 
 
Posts: 155
Joined: Wed Aug 22, 2012 11:43 am

Re: Combobox Condition

Post by petejos »

WWBman wrote: Wed Sep 19, 2018 8:36 am Did you test the scenario I mentioned in my previous post?
I.e. the user fills in e.g. 5 boxes and then changes their mind and changes to e.g. 3 boxes.
Were boxes 4 and 5 excluded in the email?
Not yet tested yours. However my desired design is still combo box.
WWBman
 
 
Posts: 916
Joined: Fri Jan 08, 2010 6:10 pm

Re: Combobox Condition

Post by WWBman »

petejos wrote: Wed Sep 19, 2018 8:52 am
WWBman wrote: Wed Sep 19, 2018 8:36 am Did you test the scenario I mentioned in my previous post?
I.e. the user fills in e.g. 5 boxes and then changes their mind and changes to e.g. 3 boxes.
Were boxes 4 and 5 excluded in the email?
Not yet tested yours. However my desired design is still combo box.
I didn't mean test mine. Did you test yours with the 5 boxes filled in then 3.
petejos
 
 
Posts: 155
Joined: Wed Aug 22, 2012 11:43 am

Re: Combobox Condition

Post by petejos »

WWBman wrote: Wed Sep 19, 2018 10:05 am
petejos wrote: Wed Sep 19, 2018 8:52 am
WWBman wrote: Wed Sep 19, 2018 8:36 am Did you test the scenario I mentioned in my previous post?
I.e. the user fills in e.g. 5 boxes and then changes their mind and changes to e.g. 3 boxes.
Were boxes 4 and 5 excluded in the email?
Not yet tested yours. However my desired design is still combo box.
I didn't mean test mine. Did you test yours with the 5 boxes filled in then 3.
Hi wwbman, you are right. They are not excluded in the email if they change the choices.
petejos
 
 
Posts: 155
Joined: Wed Aug 22, 2012 11:43 am

Re: Combobox Condition

Post by petejos »

hi wwbman

How does this javascript works?
clearbox2();

The name of my editbox is "camper1name"
petejos
 
 
Posts: 155
Joined: Wed Aug 22, 2012 11:43 am

Re: Combobox Condition

Post by petejos »

btw, I just tested and your javascript does not work. What went wrong? any idea?
WWBman
 
 
Posts: 916
Joined: Fri Jan 08, 2010 6:10 pm

Re: Combobox Condition

Post by WWBman »

My test version does work. What are you seeing that doesn't work?
You'll find the clearboxn(); routines in Page HTML under Before </body>.
They simply clear the relevant editbox.
Just replace my editbox names e.g. indexEditbox1 with yours e.g. camper1name
petejos
 
 
Posts: 155
Joined: Wed Aug 22, 2012 11:43 am

Re: Combobox Condition

Post by petejos »

WWBman wrote: Thu Sep 27, 2018 9:43 am My test version does work. What are you seeing that doesn't work?
You'll find the clearboxn(); routines in Page HTML under Before </body>.
They simply clear the relevant editbox.
Just replace my editbox names e.g. indexEditbox1 with yours e.g. camper1name
When i tried yr version, firstly i choose 3 then enter details then i chooee 1 and submit. The result i received are still 3.
WWBman
 
 
Posts: 916
Joined: Fri Jan 08, 2010 6:10 pm

Re: Combobox Condition

Post by WWBman »

In a previous post I mentioned this.
Did you download the new version?
petejos
 
 
Posts: 155
Joined: Wed Aug 22, 2012 11:43 am

Re: Combobox Condition

Post by petejos »

WWBman wrote: Thu Sep 27, 2018 11:52 am In a previous post I mentioned this.
Did you download the new version?
Yes I did.
WWBman
 
 
Posts: 916
Joined: Fri Jan 08, 2010 6:10 pm

Re: Combobox Condition

Post by WWBman »

Sorry but it works for me.
Can you share your .wbs file to see if I can spot any problem?
petejos
 
 
Posts: 155
Joined: Wed Aug 22, 2012 11:43 am

Re: Combobox Condition

Post by petejos »

WWBman wrote: Thu Sep 27, 2018 11:52 am In a previous post I mentioned this.
Did you download the new version?
My apology. I made some errors and now it is working.
btw, I need to unchecked a box when a different selection is made. For example, when a selection is made, i need one of the checked box in my form to be unchecked.
WWBman
 
 
Posts: 916
Joined: Fri Jan 08, 2010 6:10 pm

Re: Combobox Condition

Post by WWBman »

I think you can uncheck a box with e.g. nameofRadioButton.checked = false;
petejos
 
 
Posts: 155
Joined: Wed Aug 22, 2012 11:43 am

Re: Combobox Condition

Post by petejos »

WWBman wrote: Fri Sep 28, 2018 7:49 am I think you can uncheck a box with e.g. nameofRadioButton.checked = false;
That works. Thanks.

Can I also know how to reset a combobox please? Thanks.
WWBman
 
 
Posts: 916
Joined: Fri Jan 08, 2010 6:10 pm

Re: Combobox Condition

Post by WWBman »

Try:
document.getElementById('Combobox1').options.length = 0;
or just:
Combobox1.options.length = 0;
petejos
 
 
Posts: 155
Joined: Wed Aug 22, 2012 11:43 am

Re: Combobox Condition

Post by petejos »

WWBman wrote: Sun Sep 30, 2018 8:53 am Try:
document.getElementById('Combobox1').options.length = 0;
or just:
Combobox1.options.length = 0;
thanks. i tried, but it actually disable the combobox instead of reset to initial value/text
WWBman
 
 
Posts: 916
Joined: Fri Jan 08, 2010 6:10 pm

Re: Combobox Condition

Post by WWBman »

Try:
Combobox1.reset();
petejos
 
 
Posts: 155
Joined: Wed Aug 22, 2012 11:43 am

Re: Combobox Condition

Post by petejos »

WWBman wrote: Sun Sep 30, 2018 9:44 am Try:
Combobox1.reset();
Truly appreciated your quick respond. It still doesn't reset. :(
WWBman
 
 
Posts: 916
Joined: Fri Jan 08, 2010 6:10 pm

Re: Combobox Condition

Post by WWBman »

As you probably gathered I'm not a Javascript expert!!
If the user is selecting one item then try:
Combobox1.selectedIndex = 0;
petejos
 
 
Posts: 155
Joined: Wed Aug 22, 2012 11:43 am

Re: Combobox Condition

Post by petejos »

WWBman wrote: Sun Sep 30, 2018 10:07 am As you probably gathered I'm not a Javascript expert!!
If the user is selecting one item then try:
Combobox1.selectedIndex = 0;
bingo. it works. Thanks a lot.
petejos
 
 
Posts: 155
Joined: Wed Aug 22, 2012 11:43 am

Re: Combobox Condition

Post by petejos »

petejos wrote: Tue Sep 18, 2018 12:59 am
WWBman wrote: Mon Sep 17, 2018 12:23 pm It works with Radio Buttons but not (currently) for Comboboxes.
E.g. http://www.mediafire.com/file/as7v9n29p ... s.wbs/file
@petejos, are you using Radio Buttons or Comboboxes?
I am using combo boxes. What would you recommend.
Hi WWBman, i would like to know how did you hide your editboxes on loading?
WWBman
 
 
Posts: 916
Joined: Fri Jan 08, 2010 6:10 pm

Re: Combobox Condition

Post by WWBman »

In the Object Manager untick Visible.
petejos
 
 
Posts: 155
Joined: Wed Aug 22, 2012 11:43 am

Re: Combobox Condition

Post by petejos »

WWBman wrote: Sun Sep 30, 2018 11:52 am In the Object Manager untick Visible.
my form is created with layout grid. i untick the visible but when i load the page and make my selection, the editboxes is not display
WWBman
 
 
Posts: 916
Joined: Fri Jan 08, 2010 6:10 pm

Re: Combobox Condition

Post by WWBman »

Did you set the onclick event to Show?
See my test project.
petejos
 
 
Posts: 155
Joined: Wed Aug 22, 2012 11:43 am

Re: Combobox Condition

Post by petejos »

WWBman wrote: Sun Sep 30, 2018 12:11 pm Did you set the onclick event to Show?
See my test project.
I did. strangely it doesn't work
WWBman
 
 
Posts: 916
Joined: Fri Jan 08, 2010 6:10 pm

Re: Combobox Condition

Post by WWBman »

Does it work as a standard form instead of a layout grid form?
If so then I have no idea what the problem is.
Have you double checked all the id names in the events etc.?
WWBman
 
 
Posts: 916
Joined: Fri Jan 08, 2010 6:10 pm

Re: Combobox Condition

Post by WWBman »

I've just tested it with a Layout Grid form and it seems to work.
petejos
 
 
Posts: 155
Joined: Wed Aug 22, 2012 11:43 am

Re: Combobox Condition

Post by petejos »

WWBman wrote: Sun Sep 30, 2018 1:14 pm I've just tested it with a Layout Grid form and it seems to work.
Have you have any problem the radio button not showing selected after you selected one of them?
WWBman
 
 
Posts: 916
Joined: Fri Jan 08, 2010 6:10 pm

Re: Combobox Condition

Post by WWBman »

I guess you've seen Pablo's reply here:
viewtopic.php?f=5&t=82640&sid=78c960302 ... e9d75bf6ba

FWIW: I've updated my test project to reflect this.
Post Reply