troubleshooting Question

form values are not coming even though serialize() is used in the case of jquery modal window.

Avatar of chaitu chaitu
chaitu chaituFlag for India asked on
3 Comments1 Solution493 ViewsLast Modified:
form values are not coming to server side in the case of jquery modal window.

i used $('#users').serialize() to serialize text box values which are under table id ='users'.

my doubt is this table is not under form thats why values are not to solve this problem??

<style type="text/css">
<link rel="stylesheet" href="" />
<script type="text/javascript" src=""></script>
<script type="text/javascript" src=""></script>
<meta charset="utf-8">
        body { font-size: 62.5%; }
        label, input { display:block; }
        input.text { margin-bottom:12px; width:95%; padding: .4em; }
        fieldset { padding:0; border:0; margin-top:25px; }
        h1 { font-size: 1.2em; margin: .6em 0; }
        div#users-contain { width: 350px; margin: 20px 0; }
        div#users-contain table { margin: 1em 0; border-collapse: collapse; width: 100%; }
        div#users-contain table td, div#users-contain table th { border: 1px solid #eee; padding: .6em 10px; text-align: left; }
        .ui-dialog .ui-state-error { padding: .3em; }
        .validateTips { border: 1px solid transparent; padding: 0.3em; }
    $(function() {
        // a workaround for a flaw in the demo system (, ignore!
        $( "#dialog:ui-dialog" ).dialog( "destroy" );
        $( "#dialog-form" ).dialog({
            autoOpen: false,
            height: 550,
            width: 350,
            modal: true,
            buttons: {
                "Create an account": function() {
                    var bValid = true;
                  $( this ).dialog( "close" );
                Cancel: function() {
                    $( this ).dialog( "close" );
          /*  close: function() {
                allFields.val( "" ).removeClass( "ui-state-error" );

function callAJAX()
						url: "url",
						dataType: "json",
						data: $('#users').serialize(),
						contentType: "application/json; charset=utf-8",
					    success: function(data){ 
							error: function(e, xhr){ 

        $( "#create-user" )
            .click(function() {
                $( "#dialog-form" ).dialog( "open" );
					$( "#fname" ).val($( "#fname1" ).val());
					$( "#lname" ).val($( "#lname1" ).val());
					$( "#email" ).val($( "#email1" ).val());
					$( "#zipcode" ).val($( "#zipcode1" ).val());

<div class="demo">

<div id="dialog-form" title="Create new user">
    <p class="validateTips">All form fields are required.</p>

    <form id='frm'>
        <label for="name">First Name</label>
        <input type="text" name="name" id="fname"  class="text ui-widget-content ui-corner-all" />
        <label for="email">Email</label>
        <input type="text" name="email" id="email" value="" class="text ui-widget-content ui-corner-all" />
        <label for="zipcode">Zip Code</label>
        <input type="text" name="zipcode" id="zipcode" value="" class="text ui-widget-content ui-corner-all" />
        <label for="lname">Last Name</label>
        <input type="text" name="lname" id="lname" value="" class="text ui-widget-content ui-corner-all" />

<div id="users-contain" class="ui-widget">
    <h1>Existing Users:</h1>
    <table id="users" class="ui-widget ui-widget-content">
            <tr class="ui-widget-header ">
                <td>First Name</td><td>   <input type="text" name="fname1" id="fname1"  /></td>
                <td>Last Name</td><td>   <input type="text" name="lname1" id="lname1"  /></td>
          <tr class="ui-widget-header ">
                <td>Zip Code</td><td>   <input type="text" name="zipcode1" id="zipcode1"  /></td>
                <td>Email</td><td>   <input type="text" name="email1" id="email1"   /></td>
            <tr class="ui-widget-header ">
                <td>SSN</td><td>   <input type="text" name="ssn" id="ssn"  /></td>
                <td>DOB</td><td>   <input type="text" name="dob" id="dob"  /></td>
          <tr class="ui-widget-header ">
                <td>Address</td><td><input type="text" name="addr" id="addr"  /></td>
                <td>City</td><td>   <input type="text" name="city" id="city"  /></td>
<button id="create-user">Create new user</button>


Open in new window

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros