JavaScript - prompt box with multiple input fields

Asked By Sivakumar N on 14-Jul-11 07:52 AM
Hi,

      I want javascript prompt box with multiple input fields please can any help me for this...!
     
      Like:- inside the single prompt there is multiple input fields

Thanks and Regards
siva
Web Star replied to Sivakumar N on 14-Jul-11 07:56 AM
You could use a popup window with a form where you can take multiple field for you need.
Jitendra Faye replied to Sivakumar N on 14-Jul-11 07:56 AM
Using Javascript prompt you can not take multiple values.

For that you can use Jquery popup.

after adding jqueryui plugin you can use it.

like this-

<script>

function funShow() {

$('#dialog).dialog({ resizable: false, height: 140, modal: true });

}
</script>

<div id="dialog" title="Basic dialog">
 <input type="text" id="txt1">
 <input type="text" id="txt2">
</div>


<asp:Button runat="server" Text="Button" onClientClick="return funShow()" />

FOR EXAMPLE FOLLOW THIS

-http://jqueryui.com/demos/dialog/

 

dipa ahuja replied to Sivakumar N on 14-Jul-11 08:29 AM
Hi..

I think there is another way to do this.. you can try the ajaxModalPopupExtender and inside teh popup panel take any no. of textboxes you want and perform the code

<cc1:ModalPopupExtender TargetControlID="Button3" 
BackgroundCssClass="modalBackground"
PopupControlID="Panel1" 
PopupDragHandleControlID="btnMsg" 
ID="ModalPopupExtender2"
runat="server"/>
<asp:Button ID="Button3" runat="server" Text="Take Input"/>  
  <asp:Panel ID="Panel1" runat="server" Height="80" CssClass="ModalWindow">
  <%--Take textboxes here--%>
    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</asp:Panel>
Devil Scorpio replied to Sivakumar N on 14-Jul-11 10:59 AM
Hi Sivakumar,

Please find the javascript saple code of prompt box with multiple input fields

<html>
<head>
<script type="text/javascript">
function disp_prompt()
{
var name=prompt("Please enter your name","")
var Age=prompt("Please enter your Age","")
if (name!=null && name!="")
{
if (Age != null && Age != "")
{
document.write("Hello " + name + "! Your age is "+ Age);
}

}
}
</script>
</head>
<body>
<form>
<input type="button" onclick="disp_prompt()" value="Display a prompt box">
</form>
</body>

</html>