Q:

Jquery modal form is posting twice

I'm using jquery custombox , but i have a problem when posting modal forms.
The values are posting twice because the form appears twice on html source once i initialize the modal window.
One appears from my fn.custom box when i click on the '#att=add' and the other one on the bottom of the page but with display: none;
How can i post just the displayed form ?
Here is my js.
$s = jQuery.noConflict();
$s(document).ready(function() {

   //Afisam modal pentru adaugare atribut
    $s('#att-add').live('click', function (e) {
        $s.fn.custombox( this, {
            overlay: true,
            effect: 'fadein',
            eClose: '.close',
            width: 300,
            close: function () { 
                        $s('.groups').selectric('destroy');
                        $s("label.error").hide();
                 }
        });
          e.preventDefault();
          $s('.groups').selectric();
    });

   //Afisam modal pentru editare atribut
    $s('#att-edit').live('click', function (e) {
      e.preventDefault();
        var id = $s(this).data('id');
          $s.ajax({
                type: "POST",
                url: "index.php?controller=attribute&method=edit",
                data: {id: id},
                    success: function(data) {
                        $s('.attribute-edit').html(data); 
              $s('.groups').selectric();
                    }

        });
        $s.fn.custombox( this, {
            overlay: true,
            effect: 'fadein',
            eClose: '.close',
            width: 300,
            close: function () { 
                        $s('.groups').selectric('destroy');
                        $s("label.error").hide();
                    }
        });

    });

   //Validam si actualizam atributul
   $s('#updateAttribute').live('click', function (e) {
    e.preventDefault();
    $s('.groups').change(function(){
        if ($s(this).val()!="")
        {

            $s(this).valid();
        }
    });
      $s('#form-attribute-update').validate({
        ignore: [],
        rules: {
          name: {
            required: true,
            minlength: 2
          },
          groups: {
            required: true
          }
        },
        errorPlacement: function (error, element) {
            if (element.attr("name") == "groups") {
              error.insertAfter(".selectric");
            } else {
              error.insertAfter(element);
            }
        },

        messages: {
          name: {
            required: "Completeaza numele atributului.",
            minlength: "Minim 2 caractere."
          },
          groups: {
            required: "Selectati un grup"
          }
        }

      });

      if ( $s('#form-attribute-update').valid() ) {
          $s.ajax({
              type: 'post',
              url: 'index.php?controller=attribute&method=updateAttribute',
              data: $s('#form-attribute-update').serialize(),
                  success: function(){
                    // window.location.href = "index.php?controller=attribute";
               }

          }); 
          return false; 
      }
    });
   });

This is what i'm getting on xhr post :
Parametersapplication/x-www-form-urlencoded
groups  1
groups  1
id  7
id  7
name    Intel
name    Intel
ordine  0
ordine  0

The html
  <div id="modal-edit-attribute" style="display: none;" class="modal-content">
    <div class="modal-header">
        <button type="button" class="close" title="inchide">&times;</button>
        <h3>Actualizeaza atributul</h3>
    </div>
    <div class="modal-body attribute-edit">
                   <form id="attributeupdate" method="post">
            <div class="form-group">
              <label>Numele atributului</label> -id ={$atribute.attribute_id}
              <input type="text" name="name" autocomplete="off" value="{$atribute.name}" />
            </div>
            <div class="form-group">
              <label>Selectati grupul de atribute</label>
              <select name="groups" class="groups">
                <option value="">Selecteaza grupul</option>
                {section name=op loop=$groups.attribute_group_id}
                 <option value="{$groups.attribute_group_id[op]}" {if $atribute.attribute_group_id == $groups.attribute_group_id[op]} selected="selected" {/if}>{$groups.name[op]}</option>
                 {/section}
              </select>
            </div>
            <div class="form-group">
              <label>Ordinea</label>
              <input class="ordine" type="text" name="ordine" value="{$atribute.sort_order}"/>
              <input type="hidden" name="id" value="2"/>
            </div>
            <div class="form-group form-btn">
              <button class="bluebtn" id="updateAttribute">Actualizeaza atributul</button>
          </div>
      </form>
    </div>
    <div class="clear"></div>
</div>

The form is loaded inside modal-body.
After the body tag i'm getting
<div id="custombox-modal" class="custombox-modal custombox-fadein custombox-show" style="z-index: 10001; margin-left: -151px; width: 302px; position: absolute;" data-custombox-scroll="0" data-custombox="function () { 
                        $s('.groups').selectric('destroy');
                        $s(&quot;label.error&quot;).hide();
                    }"><div id="custombox-modal-content" class="custombox-modal-content" style="transition-duration: 600ms;"><div style="display: block; width: auto;" class="modal-content" id="modal-edit-attribute" data-custombox-width="302">
        <div class="modal-header">
            <button title="inchide" class="close" type="button">×</button>
            <h3>Actualizeaza atributul</h3>
        </div>
        <div class="modal-body attribute-edit">              <form method="post" id="attributeupdate">
                <div class="form-group">
                  <label>Numele atributului</label> -id =1
                  <input type="text" value="Capacitate" autocomplete="off" name="name">
                </div>
                <div class="form-group">
                  <label>Selectati grupul de atribute</label>
                  <div class="selectricWrapper groups"><div class="selectricHideSelect"><select class="groups" name="groups">
                    <option value="">Selecteaza grupul</option>
                                         <option selected="selected" value="1">Specificatii</option>
                                          <option value="2">Tara de provenienta</option>
                                          <option value="3">Tip produs</option>
                                       </select></div><div class="selectric"><p class="label">Specificatii</p><b class="button">▾</b></div><div tabindex="-1" class="selectricItems"><ul><li class="">Selecteaza grupul</li><li class="selected">Specificatii</li><li class="">Tara de provenienta</li><li class=" last">Tip produs</li></ul></div><input type="text" class="selectricInput"></div>
                </div>
                <div class="form-group">
                  <label>Ordinea</label>
                  <input type="text" value="0" name="ordine" class="ordine">
                  <input type="hidden" value="2" name="id">
                </div>
                <div class="form-group form-btn">
                  <button id="updateAttribute" class="bluebtn">Actualizeaza atributul</button>
              </div>
          </form></div>
        <div class="clear"></div>
    </div></div></div>

A:

Solved it with 
$s('.modal-content:gt(0)').remove();

after validation

