{* Smarty *}

{literal}
<script type="text/javascript">
//<![CDATA[

$(function() {
  AltButtons();
});

$(function() {
  $("input[name='demandsclassif_name']").css("width","400px");
  $("input[name='demandsclassif_order']").css("width","400px");
});

function showResponseFormDemandsClassifAdd(responseText){
  if(typeof(responseText['error'])=='undefined'){
    $("#GridDemandsClassif").trigger("reloadGrid");
    $("#DemandsClassifEditFrm").dialog("destroy");
    DialogStandartMessageOpen("message", responseText['message']);
  }
  else{
    DialogStandartMessageOpen("error", responseText['error']);
  }
}

$(function(){
  var options = {
    success: showResponseFormDemandsClassifAdd,
    timeout: 3000
  };
  $("#FormDemandsClassifAdd").validate({
    submitHandler: function(form) {
      $(form).ajaxSubmit(options);
    },
    ignore: "",
    rules : {
      "demandsclassif_name" : {required : true},
      "demandsclassif_order" : {
        required : true,
        number: true
      }
    },
    errorPlacement: function(error, element) {
      var er = element.attr("name");
      error.appendTo($("label[for='" + er + "']").next() );
    }
  });
});
//]]>
</script>
{/literal}

<form action="{$MS_SP->Sp_PathTop}{$MS_SP->Sp_PathToSite}/AjaxServer/DemandsClassifSave.ajax.php" method="post" name="FormDemandsClassifAdd" id="FormDemandsClassifAdd">
  <input id="demandsclassif_id" name="demandsclassif_id" type="hidden" value="{if isset($ArrDemandsClassif.demandsclassif_id)}{$ArrDemandsClassif.demandsclassif_id}{/if}" />
  <table>
    <tr>
      <td><label for="demandsclassif_name">Наименование <span class="ui-state-error">* </span>:&nbsp;</label><span></span></td>
      <td colspan="2"><input type="text" id="demandsclassif_name" name="demandsclassif_name" value="{if isset($ArrDemandsClassif.demandsclassif_name)}{$ArrDemandsClassif.demandsclassif_name}{/if}" /></td>
    </tr>
    <tr>
      <td><label for="demandsclassif_order">Сортировка <span class="ui-state-error">* </span>:&nbsp;</label><span></span></td>
      <td colspan="2"><input type="text" id="demandsclassif_order" name="demandsclassif_order" value="{if isset($ArrDemandsClassif.demandsclassif_order)}{$ArrDemandsClassif.demandsclassif_order}{/if}" /></td>
    </tr>
    <tr>
      <td colspan="3">
        <span class="ui-state-error"> * </span>поля обязательные для заполнения
      </td>
    </tr>
    <tr>
      <td colspan="3" class="MsFormSubmit"><input class="AltButtons" name="FormSubmit" value="сохранить" type="submit" /></td>
    </tr>
  </table>
</form>