Search code examples
liferayliferay-aui

how to display text box value in aui popup in liferay?


in this jsp i have displayed the popup when i click it on button using aui.. i want to display the text box value when i click it on the popup box can any one help me?.i dont know how to use pop.

<%@ taglib uri="http://liferay.com/tld/aui" prefix="aui" %>

<div id="a">
    <aui:input lable="enter name" name="name" type="text"></aui:input>
</div>
<div id="b">
    <aui:button name="hello" value="click me" onclick='callPopup()'></aui:button>
</div>

<aui:script >

function callPopup(){

    AUI().ready('aui-dialog', 'aui-overlay-manager', 'dd-constrain', function(A) {
        alert('hai sudheer');
        var dialog = new A.Dialog({

            title: 'DISPLAY CONTENT',

            centered: true,

            modal: true,

            draggable:true,

            width: 300,

            height: 300,

            closeOnOutsideClick: true,

            bodyContent: "This is testing content inside the popup"

        }).render();

    });

}

</aui:script >

Solution

  • <%@ taglib uri="http://liferay.com/tld/aui" prefix="aui" %>
    <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
    <aui:input lable="enter name" name="name" type="text" id="b"></aui:input>
    <div id="a">
    <aui:button name="hello" value="click me" onclick='callPopup()'></aui:button>
    </div>
    <portlet:namespace/>
    <aui:script >
    
    function callPopup(){
    
    AUI().ready('aui-dialog', 'aui-overlay-manager', 'dd-constrain', function(A) {
    var name = document.getElementById("_popexample_WAR_popupexampleportlet_b").value;
    var sudheer="hai"+name;
    alert('hai sudheer'+name);
    var dialog = new A.Dialog({
    
    title: 'DISPLAY CONTENT',
    
    centered: true,
    
    modal: true,
    
    draggable:true,
    
    width: 300,
    
    height: 300,
    
    bodyContent: sudheer
    
    }).render();
    
    });
    
    }
    
    </aui:script >
    

    its working fine....tested...thanks