Add a button to a form of dialog for add new item for droplist

28 views
Skip to first unread message

Anderson Florencio

unread,
Nov 22, 2015, 6:48:32 PM11/22/15
to ZnetDK
Hello, I'm new using ZnetDK and am trying to add a button on a form of a dialog, the side of a droplist menu to trigger another dialog to add an object to droplist menu. My attempts resulted in a grouping that button with the buttons form actions, or simply opened the new modal dialog in the background. Please, I would like some help in this regard.
Message has been deleted

Pascal Martinez

unread,
Nov 23, 2015, 3:22:09 PM11/23/15
to zne...@googlegroups.com
Hello,

I'm not sure to understand precisely your need.
When you speak about the "droplist menu", do you mean the dropdown widget?

To open a dialog when you click on a button, add a JavaScript event handler to your view.

For example: 
<form class='zdk-form'>
   <button id='mybutton' type='button'>My button</button>
</form>

<div id='mydialog' class='zdk-modal'>
   <!-- The content of your dialog -->
</div>

<script type="text/javascript">

    $(document).ready(function () {
        $('#mybutton').puibutton({
            click: function() {
                $('#mydialog').zdkmodal('show');
            }
        });
    });

</script>

Hoping it will be helpful.

Pascal MARTINEZ

Anderson Florencio

unread,
Nov 24, 2015, 8:13:10 AM11/24/15
to zne...@googlegroups.com
Pascoal Martinez, thanks for the reply. It was that's exactly what I meant, rs.
This code worked, but as I mentioned, when you place a <button> inside a ZDK-form, automatically the framework brings together all form buttons in the same <div>.

But managed to solve, rather than


<form class = 'ZDK-form ">
<button id =' mybutton 'type =' button '> My button </ button>
 </ form>


I changed the "button" for "a"


<form class = 'ZDK-form ">
<a id='mybutton'> My button </a>
 </ form>




Thus my new button will not be grouped with the other! Thanks again.

Pascal Martinez

unread,
Nov 25, 2015, 3:50:19 PM11/25/15
to ZnetDK
Hello Anderson,

In version 1.0, indeed the buttons declared into a zdkform are systematically grouped at the bottom of the form.

In the future version 1.1, only the buttons directly declared under the form element will be grouped. 
In this way, a button declared under a sub-element like a div will not be grouped, like the example shown below:

<form class="zdk-form">
       
<div>

             
<button id="mybutton" type="button">My button</button>

       
</div>
</form>

Regards,

Pascal MARTINEZ
Reply all
Reply to author
Forward
0 new messages