bhavs
bhavs

Reputation: 2301

java script dialog box with 2 inputs

to maintain consistency with the alert and prompt dialogs boxes in java script I am wondering if there is a dialog box which cab accept 2 inputs instead of one?

I have tried a couple of methods like :

creating a form

<form id="management_form">
Enter Option: <input type="text" id="optiontb" name="option">
<input type="button" onclick="myfunction(this.form)" value="submit"> </form>

and calling

document.management_form.submit(); in the java script method

this displays the form wherever the form code is in the htmlfile. and not when the form is called

and creating

a form using

var newdiv = document.createElement();
newdiv.innerHTML = "Entry  <br><input type='text' name='myInputs[]'>";
document.appendChild('newdiv');

for this I see and error Uncaught error:NOT_FOUND_ERROR:DOM Exception8

Are there better ways to do this ?

Edit: After performing some operations as suggested below by Girish :

the html code is as follows :

<title>
<style>
 I have include the code for the style
</style>
<script>
 function request()// renamed it here 
   { // this is exactly same the code in the sample web site
      }

how i am calling this java script method

 function myfunction(frm)
  {
var opt=frm.option.value;  
request();
$( "#dialog-form" ).dialog( "open" ); 

} this gets called from

 <form name="management_form">
  Enter Option: <input type="text" id="optiontb" name="option"> 
 <input type="button" onclick="myfunction(this.form)" value="submit"> </form>

anything that can be added here so that this gets displayed as a dialog and not like a html page ?

Upvotes: 0

Views: 862

Answers (1)

Gaurav Agrawal
Gaurav Agrawal

Reputation: 4431

I think you want this type of functionality, so you can check this URL

http://jqueryui.com/demos/dialog/modal-form.html

and it you liked this then please download its code and implement this into your code.....

Upvotes: 2

Related Questions