jQuery UI Widgets › Forums › ASP .NET MVC › jqEditor will not work inside dynamic loaded mvc form
Tagged: editor, jqwidgets window, jqxEditor MVC, window
This topic contains 1 reply, has 2 voices, and was last updated by Hristo 6 years, 6 months ago.
-
Author
-
Hi,
I have a problem with the jqx Editor.
I have a form that I load within a jqx window like this:
$(‘#AddNewWindow’).on(‘open’, function (event) {
$(‘#AddnewDiv’).empty();
$(‘#AddnewDiv’).load(“/Home/GetView”, { ViewName: “_AddEditComplaint”, mode: mode, Id }, function () {
after this I change one input tag to a jqxEditor:
$(‘#complaint_complainttext’).jqxEditor({
height: ‘200px’,
width: ‘800px’
});
This seems to work it renders the editor as expected.
But when I submit the form and try to extract the form data I always get an empty complaint_complainttext value.
$(‘#saveBtn’).click(function () {
var formdata = $(‘#complaintForm’).serialize();
//alert($(‘#complaint_complainttext’).jqxEditor(‘val’));//alert stays also empty
$.ajax(
{
type: ‘POST’,
data: formdata,
url: ‘Home/Save’,
success: function (data) {
alert(data);
$(‘#AddNewWindow’).jqxWindow(‘close’);
}
});
});
If I comment out the construction of the jqxEditor and just leave the input tag as it is Original everything works ok.this is my cshtml:
<div class=”form-group”>
@Html.LabelFor(model => model.complaint.ata, htmlAttributes: new { @class = “control-label col-md-2″ })
<div class=”col-md-10”>
@Html.DropDownListFor(model => model.complaint.ata, Model.ATAChapters as List<SelectListItem>, new { htmlAttributes = new { @class = “form-control” } })
</div>
</div>and this is my renderd HTML:
With Editor:<input name=”complaint.complainttext” class=”form-control editor text-box single-line jqx-widget jqx-editor-inline jqx-rc-all” id=”complaint_complainttext” contenteditable=”true” type=”text” value=””>
Without Editor:
<input name=”complaint.complainttext” class=”form-control editor text-box single-line” id=”complaint_complainttext” contenteditable=”true” type=”text” value=””>somebody know what I am doing wrong??
Rob
Hello Rob,
I would ask you how you initialize the jqxEditor in jqxWindow.
Because theinitContent
callback is important to use when initializing widgets in jqxWindow.
It should be something like in this example: http://jsfiddle.net/jqwidgets/STCPV/Best Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.