Search code examples
alloy-ui

AlloyUI: Add Element on object 'modal'


I try to create a Portlet which use a JSP with Alloy UI to display informations.

I like the effect of the module 'Modal' - Link

The effect is, that a box opens, if I click a button (you can see it if you follow the link).

There are two buttons in this example. I want to replace them by a text field / input field.

How can I do this?

Sincerely, JC.


Solution

  • For me, 'contentBox' worked fine. I added to the modal object

    contentBox: '#contentBox',
    

    and defined a div container with my textbox in

    <div id="contentBox">
        <aui:form>
            <aui:fieldset>
                <aui:input name="productName" size="45" />
                <aui:button-row>
                    <aui:button id="closeModal" value="Close" class="btn"></aui:button>
                    <aui:button type="submit" onSubmit="cm();" />
                </aui:button-row>
            </aui:fieldset>
        </aui:form>
    </div>
    

    I don't know if there is a better solution, but I had to write the div container in the html content, but I wanted to display it only in the modal box that opens by click. So I had to hide it, it works by adding

    render: '#modal', 
    

    to the modal object.