jQuery UI Widgets Forums ASP .NET MVC jqEditor will not work inside dynamic loaded mvc form

This topic contains 1 reply, has 2 voices, and was last updated by  Hristo 6 years, 6 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author

  • RobWarning
    Participant

    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


    Hristo
    Participant

    Hello Rob,

    I would ask you how you initialize the jqxEditor in jqxWindow.
    Because the initContent 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 Hristov

    jQWidgets team
    http://www.jqwidgets.com

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.