Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I put a dialog div in form tag

I have a page where I've tried to put a JQuery dialog where data is entered and later goes to a server. The problem I've encountered is that the dialog is outside the form tag, since that whole data I enter is lost somewhere. It looks like this: enter image description here

I've tried this so far:

var dialogAddPartDiv = $('.dialogAddPart'); 
$('form').append(dialogAddPartDiv);

But it only appends dialogAddPart, not its parents.

The command $('form').append('.ui-dialog') doesn't work in this case. How can I add the parent div of .dialogAddPart in form? The technology I use is XPages, since that I cannot use a inner button inside dialog declaration to proccess AJAX request, all that stuff is defined inside the XPage itself.

like image 345
J.Nick Avatar asked Jan 24 '18 05:01

J.Nick


People also ask

How do I display a dialog box in HTML?

The show() method shows the dialog. When this method is used to show a dialog window, the user is still able to interact with other elements on the page. If you do not want the user to interact with things other than the dialog, use the showModal() method.

What is dialog HTML?

<dialog>: The Dialog element. The <dialog> HTML element represents a dialog box or other interactive component, such as a dismissible alert, inspector, or subwindow.

How do I increase the size of dialog box in HTML?

var iHeight = $('#dialog'). height() + 16; After the dialog is created, set the new width for the dialog wrapper and start an animate if the current height is lower then the calculated.

What is dialog open?

A dialog is opened by calling the open method with a component to be loaded and an optional config object. The open method will return an instance of MatDialogRef : let dialogRef = dialog. open(UserProfileComponent, { height: '400px', width: '600px', }); The MatDialogRef provides a handle on the opened dialog.


1 Answers

jQuery UI Dialog has an appendTo option which allows you to append the dialog to some element:

$( ".selector" ).dialog({
  appendTo: "#someElem"
});
like image 142
Kirill Simonov Avatar answered Oct 15 '22 14:10

Kirill Simonov