{* Smarty *}

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

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

$(function() {
  $("input[name='cartridgetype_name']").css("width","400px");
  $("input[name='cartridgetype_partcode']").css("width","400px");
  $("input[name='cartridgetype_numprintlist']").css("width","400px");
  $("input[name='cartridgetype_writeoff']").css("width","400px");
});

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

$(function(){
  var options = {
    success: showResponseFormCartridgeTypeAdd,
    timeout: 3000
  };
  $("#FormCartridgeTypeAdd").validate({
    submitHandler: function(form) {
      $(form).ajaxSubmit(options);
    },
    ignore: "",
    rules : {
      "cartridgetype_name" : {required : true},
      "cartridgetype_numprintlist" : {number : true},
      "cartridgetype_writeoff" : {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/CartridgeTypeSave.ajax.php" method="post" name="FormCartridgeTypeAdd" id="FormCartridgeTypeAdd">
  <input id="cartridgetype_id" name="cartridgetype_id" type="hidden" value="{if isset($ArrCartridgeType.cartridgetype_id)}{$ArrCartridgeType.cartridgetype_id}{/if}" />
  <table>
    <tr>
      <td><label for="cartridgetype_name">Наименование <span class="ui-state-error">* </span>:&nbsp;</label><span></span></td>
      <td><input type="text" id="cartridgetype_name" name="cartridgetype_name" value="{if isset($ArrCartridgeType.cartridgetype_name)}{$ArrCartridgeType.cartridgetype_name}{/if}" /></td>
    </tr>
    <tr>
      <td><label for="cartridgetype_partcode">Part № :&nbsp;</label><span></span></td>
      <td><input type="text" id="cartridgetype_partcode" name="cartridgetype_partcode" value="{if isset($ArrCartridgeType.cartridgetype_partcode)}{$ArrCartridgeType.cartridgetype_partcode}{/if}" /></td>
    </tr>
    <tr>
      <td><label for="cartridgetype_numprintlist">Количество страниц :&nbsp;</label><span></span></td>
      <td><input type="text" id="cartridgetype_numprintlist" name="cartridgetype_numprintlist" value="{if isset($ArrCartridgeType.cartridgetype_numprintlist)}{$ArrCartridgeType.cartridgetype_numprintlist}{/if}" /></td>
    </tr>
    <tr>
      <td><label for="cartridgetype_writeoff">Количество заправок :&nbsp;</label><span></span></td>
      <td><input type="text" id="cartridgetype_writeoff" name="cartridgetype_writeoff" value="{if isset($ArrCartridgeType.cartridgetype_writeoff)}{$ArrCartridgeType.cartridgetype_writeoff}{/if}" /></td>
    </tr>
    <tr>
      <td colspan="2">
        <span class="ui-state-error"> * </span>поля обязательные для заполнения
      </td>
    </tr>
    <tr>
      <td colspan="2" class="MsFormSubmit"><input class="AltButtons" name="FormSubmit" value="сохранить" type="submit" /></td>
    </tr>
  </table>
</form>