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 7743983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:40:06+00:00 2026-06-01T09:40:06+00:00

I have run into an issue where an input field within a form I’m

  • 0

I have run into an issue where an input field within a form I’m using should only be shown under certain conditions. I chose to display it with jQuery’s dialog() method. However, after the dialog() method is called, any subsequent calls to jQuery’s serialize() method will leave out that input field from the generated string. I suspect that this is somehow due to dialog() removing the element from the form or something along those lines, but I can’t seem to find a fix.

Here is the HTML and JS to reproduce the issue:

HTML:

<form id="form">
    <div id="dialog" style="display: none;">
        <input type="text" name="foo" value="bar" />
    </div>
    <!-- Other form inputs here -->
</form>

JS:

alert($('#form').serialize()); // "foo=bar"
$('#dialog').dialog({
    buttons: {
        OK: function() {
            alert($('#form').serialize()); // Should be "foo=bar", but is "" instead?
            $(this).dialog('close');
            alert($('#form').serialize()); // Still "".
            setTimeout(function() {
                alert($('#form').serialize()); // Still "".
            }, 0);
        }
    }
});

Edit:

There are several other inputs within the form that should not be shown on the dialog, so putting the form tags within the dialog div is not an option for me.

  • 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-06-01T09:40:06+00:00Added an answer on June 1, 2026 at 9:40 am

    @NicolaPeluchetti offered one possible solution, but I found this one to be less of a hassle:

    In the dialog() call options, I added the following:

    close: function() {
        $(this).appendTo('#form');
    }
    

    Basically, it sticks #dialog back into #form when the dialog is closed. This won’t help if you need the input to be part of the form while the dialog is open, but in my case, I only needed it to be available after the dialog was closed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have run into an issue where , when using Java Runtime to run
I have run into an issue with JQuery form submissions and have found no
I have run into an issue with WPF and Commands that are bound to
I'm working on some screen scraping software and have run into an issue with
I am creating my first (!) database, and I have run into an issue
I have run into a small issue in my program. I have a class
I have run into a bit of a design issue with my code. I
I have recently run into a particularly sticky issue regarding committing the result of
a day before end of project i run into a complicated issue: i have
I've run into a bit of an issue. Here's a brief explanation. I have

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.