Using buttons to hide/show container <div>

danielitob 07 Nov, 2016
Hi,
I have a form with 2 buttons and 2 containers (each with some textbox .
According to which of the two buttons is clicked, it enables one of the two containers.
It is similar to the demo-fields-only events that in my case the event is triggered on the button and not on the radio box.
I entered a Multi Field with 2 buttons and under 2 DIV container (Load state = Hidden).

In Events I have 2 Events for each button (one show and one Hide events) that show or hide one of the two containers.

In setup, On load I HTML (Render Form) and on Submit Debugger.

When I click on one of the two button, it nothing happens.

Regards
Daniele
GreyHead 07 Nov, 2016
Hi Daniele,

Does it work if you add &tmpl=component to the page URL from the View Form link in the Forms Manager?

Are there any JavaScript errors showing on the form page?

Bob
danielitob 07 Nov, 2016
Hi Bob,
no, it doesn't work. No, i have not JS errors.
The 2 buttons are type Button, is it right?
Could i give you other info?

Regards
Daniele
GreyHead 07 Nov, 2016
Hi Daniele,

I think so, though I don't think I've ever used buttons+events like that.

Please post a link to the form so I can take a quick look.

Bob
GreyHead 07 Nov, 2016
Hi Daniele,

The Events function is being run with the type=button form but the container is not being displayed. I suspect that you may have the Event set to 'showParent' instead of just 'show' ??

Bob
danielitob 07 Nov, 2016
Hi Bob,
in attach my events.

Is it right?
Thanks and regards
Daniele
GreyHead 07 Nov, 2016
Hi Daniele,

Please try setting Parent to No as the Containers don't have a parent in the same way that say text input elements do.

Bob
danielitob 08 Nov, 2016
Hi Bob,
thanks a lot, now it works!🙂
I notice a small difference between the two versions:
1) http://www.condominiosereno.it/index.php?option=com_chronoforms5&chronoform=Testworkflow_button&tmpl=component
2) http://www.condominiosereno.it/index.php?option=com_chronoforms5&chronoform=Testworkflow_button
In 1) the two button are ok, in 2), when i pass the mouse over the buttons, the buttons are clickable only in the lower part of the buttons ... is a problem of javascript? I tested it with Google Chrome, Mozilla Firefox and Internet Explorer.

Thanks very much

Regards
Daniele
GreyHead 08 Nov, 2016
Answer
Hi Daniele,

There's a div in your template that is covering the top half of the buttons. You can add a bit of space above the buttons; or change the z-index in the CSS to bring the buttons forward.

Bob
danielitob 08 Nov, 2016
Hi Bob,
thanks very much and sorry for my mistake
have a nice day

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