Forums

Dropdown event empty doesn't trigger when dropdown is indeed empty...?

jpurlings 13 Dec, 2016
Bob,

I have a dropdown box which loads data dynamically. I have set events that when nothing is selected, a button should not appear. That works. Strange thing is that if the dropdown itself is emtpy, the button is shown. Why is this? The dropdown is empty, so nothing is selected.

In the events tab of the dropdown I just leave the 'value selected' event empty and hide the button when value indeed is emtpy, and show the button when the value isn't empty. But this doesn't appear to work when the dropdown box is empty. Why is this?

Should you be able to access my site (www.bizzaccelerator.biz), it concerns the menu 'Formats' and submenu 'business model canvas' and then the first dropdown that is shown... It's the chronoforms form BusinessModel in backend.

Greetings.
GreyHead 13 Dec, 2016
Hi jpurlings,

I'm not clear why it isn't hiding: I changed the show/hides to show parent/hide parent and added a display: none entry to the button so it is now hidden. I can't check the display as the drop-down doesn't load any options.

Bob
jpurlings 13 Dec, 2016
Bob,

Now the button disappears if the dropdown is empty, indeed. But the button doesn't appear anymore if the dropdownbox is filled and a row in the dropdown is selected... strange! I added an entry for you so the dropdown box fills, maybe you can look at it again?

Thank you!
GreyHead 13 Dec, 2016
Hi jpurlings,

That's working now - you had the show/hide set up the wrong way round :-(

Bob
jpurlings 13 Dec, 2016
Bob,

Sorry! But now the button still does appear when there are no entries in the mailbox. I deleted your entry, now you don't have anything in the dropdown box, and then the button also shouldn't be shown... Is that possible?

Greetings.
GreyHead 14 Dec, 2016
Hi jpurlings,

When you have no options you need to work out how you want to handle them. It probably makes more sense to hide that whole selector if there is nothing for it to do. For the moment I've added some code that check the count of the options and adds a default value if there are none.

Bob
jpurlings 14 Dec, 2016
Answer
Wow,

Nice solution! That works for me. Thanks!

Greetings.
jpurlings 14 Dec, 2016
Bob,

It still isn't working like I would like it. It should be simple: when a model is selected in the dropdown, the button under the dropdown should be shown, else the button shouldn't be shown. That works fine, only when the page is accessed first, the button is always shown. That shouldn't be the case. Should some JS code be added to hide the button when the page is openend? I don't no any JS... 😟 Could you help me solve this?

Thanks.
GreyHead 14 Dec, 2016
Hi jpurlings,

I switched it back to show/hide parent and that now appears to load hidden correctly

Bob
jpurlings 14 Dec, 2016
Hmmm,

I must be getting crazy. I thought I tried that. Anyway, it works!!! Thanks a lot!!

Greetings.
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount

{item:title} {images:#}