0

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 ?

1
  • It is document.body.appendChild('newdiv'); Commented May 29, 2012 at 8:31

1 Answer 1

2

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.....

Sign up to request clarification or add additional context in comments.

2 Comments

thanks for this, but I am unfortunately seeing the div form where ever I have included in the html code, and not like a dialog box as it appears on your web page. I will include the error and findings in the question above
i realised that the code sample in the link above makes use of jquery ui plugin i would rather not make use of many plugin because I need the ui to be very very light weight, any thoughts on this ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.