Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1105069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:34:26+00:00 2026-05-17T01:34:26+00:00

So i have a page that is gonna have multiple modal popups. Each one

  • 0

So i have a page that is gonna have multiple modal popups.
Each one has values that need to be sent via a form back to the page.

To ensure that each dialog is within the form I am using .parent().appendTo("#frmMain"); on the end of each dialog definition.

My problem comes when there are more than one modal declared. The modal that has the line .parent().appendTo("#frmMain"); done last is the only one that gets its values sent back via the form.

Code is quite a bit but have wanted to leave as much of it as possible.

addition: so I’ve got two of the modals working and the third isn’t. The select and textarea work and hte normal inout don’t. No idea why, any help would be much appreciated

I have lifted most of this code from the examples

HTML

<div id="edit-jde-number-dialog-form" title="Edit JdeNumber" style="display:none">
  <p class="validatejde"></p>
      <label for="jdenumber">JdeNumber: </label>
  <input type="text" name="NewJdeCustomerNumber" id ="NewJdeCustomerNumber" class="text ui-widget-content ui-corner-all" size="25"> </input>

</div>



<!-- add Item Waive reason -->
<div id="waive-incident-billing-ITEM-form" title="Reason for waiving individual item" >
  <p class="validateItemWaive" style="padding:2px"></p>
      <label >Select a reason for waiving: </label>
      <select name="ItemWaiveReason" id="ItemWaiveReason">
        <option value="reason1">Reason1</option>
        <option value="reason2">Reason2</option>
      </select>
</div> 



<!-- Add comment -->
<div id="add-incident-billing-comment-form" title="Add a comment" style="display:none">
  <p class="validatecomment" style="padding:2px"></p>
  <textarea name="incidentbillingcomment" id="incidentbillingcomment" width="100%" class="text ui-widget-content ui-corner-all"></textarea>
</div>

Javascript

$(document).ready(function () {

    // ------------------------------- For editing jde --------------------------------------

    var jdenumber = $("#jdenumber"),
    jdenumberAllFields = $([]).add(jdenumber);

    $("#edit-jde-number-dialog-form").dialog({
        autoOpen: false,
        height: 300,
        width: 350,
        modal: true,
        buttons: {
            'Change JdeNumber': function () {
                var bValid = true;

                jdenumberAllFields.removeClass('ui-state-error');
                var jdeNo = $("#NewJdeCustomerNumber");

                if (checkNotEmpty(jdeNo) == false) {
                    var tips = $(".validatejde");
                    updateTips(tips, "You must enter a jde number")
                    bValid = false;
                }


                if (bValid) {
                    $(this).dialog('close');
                    SubmitAction('UpdateJDECustomerNumber');
                }


            },
            Cancel: function () {
                $(".validatejde").text("");
                $(this).dialog('close');
            }
        },
        close: function () {
            jdenumberAllFields.val('').removeClass('ui-state-error');
        }
    }).parent().appendTo("#frmMain"); //puts the modal in the form


    $('#button-change-jde-number')
    .button()
    .click(function () {
        $('#edit-jde-number-dialog-form').dialog('open');
    });




    // --------------------------- for adding a comment --------------------------------------

    var incidentbillingcomment = $("#incidentbillingcomment"),
        incidentbillingcommentAllFields = $([]).add(incidentbillingcomment);

    $("#add-incident-billing-comment-form").dialog({
        autoOpen: false,
        height: 350,
        width: 410,
        modal: true,
        buttons: {
            'Add Comment': function () {
                incidentbillingcommentAllFields.removeClass('ui-state-error');

                var commenttext = jQuery.trim($("#incidentbillingcomment").text());
                var bValid = (commenttext.length > 0);

                if (bValid) {
                    SubmitAction('AddGeneralComment');
                }
                else {
                    var tips = $(".validatecomment");
                    updateTips(tips, "You cannot add an empty comment.");
                }
            },
            Cancel: function () {
                $(".validatecomment").text("");
                $(this).dialog('close');
            }
        },
        close: function () {
            incidentbillingcommentAllFields.val('').removeClass('ui-state-error');
        }
    }).parent().appendTo("#frmMain"); //puts the modal in the form


    $('#add-incident-billing-comment')
        .button()
        .click(function () {
            $("#add-incident-billing-comment-form").dialog('open');
        });



    // ----------------------------- For giving a ITEM Waive reason -----------------------------------

        var removalreasoncombo = $("#ItemWaiveReason"),
        removalreasonAllFields = $([]).add(removalreasoncombo);


    $("#waive-incident-billing-ITEM-form").dialog({
        autoOpen: false,
        height: 350,
        width: 410,
        modal: true,
        buttons: {
            'Waive Item': function () {

                var bValid = true;
                removalreasonAllFields.removeClass('ui-state-error');

                var selectedreasonvalue = $("#ItemWaiveReason option:selected");
                var removalreasonkey = removalreasoncombo.val();


                if (checkStringNotEmpty(selectedreasonvalue) == false) {
                    var tips = $(".validateItemWaive");
                    updateTips(tips, "You must select a waive reason.")
                    bValid = false;
                }


                if (bValid) {
                    $(this).dialog('close');
                    //bag of shite, it doesn't want to find the select using normal stuff so have hacked t together. NOOOOOOOO!
                    $("#NewItemWaiveReason").val(removalreasonkey);
                    SubmitAction('WaiveIncidentBillingITEM');
                }

            },
            Cancel: function () {
                $(".validateremoval").text("");
                $(this).dialog('close');
            }
        },
        close: function () {
            removalreasonAllFields.removeClass('ui-state-error');
        }
    }).parent().appendTo("#frmMain"); //puts the modal in the form




});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T01:34:26+00:00Added an answer on May 17, 2026 at 1:34 am

    So I figured out a way to get multiple modals to work everytime.

    As you may be aware the modal div gets moved to outside the body tag and that is why the input, select, textarea does not appear itneh form post back.

    So we need to move the div back in the form, rather than doign this on teh declaration of the dialog I did it on the button

    so the code changed to

    $("#edit-jde-number-dialog-form").dialog({
        autoOpen: false,
        height: 250,
        width: 350,
        modal: true,
        buttons: {
            'Change JdeNumber': function () {
                var bValid = true;
    
                jdenumberAllFields.removeClass('ui-state-error');
                var jdeNo = $("#JdeCustomerNumber");
    
                if (checkNotEmpty(jdeNo) == false) {
                    var tips = $(".validatejde");
                    updateTips(tips, "You must enter a jde number")
                    bValid = false;
                }
    
    
                if (bValid) {
                    $(this).dialog('close');
                    //*******************************************
                    $(this).parent().appendTo("#frmMain");  //puts the modal back in the form
                    //*******************************************
                    SubmitAction('UpdateJDECustomerNumber');
                }
    
    
            },
            Cancel: function () {
                $(".validatejde").text("");
                $(this).dialog('close');
            }
        },
        close: function () {
            jdenumberAllFields.val('').removeClass('ui-state-error');
        }
    })
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page that shows information from my database. Each array has an
I have a page that visually has two fields right on top of each
i have alot of get values that define the page the user gonna see
I have a page that has a header, content, and footer. The header and
I have a page that loads with initially just a form within an iframe,
I have a page that has a listbox with the following item template as
I have a page that I need to call from another page more that
I have a page that has a javaScript function call on it that I
I have a Telerik Menu in usercontrol that located in aspx page, I need
I have page that has some javascript that needs to run at page load.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.