{* Smarty *}

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

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

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

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

$(function(){
  var options = {
    success: showResponseFormSvtStatusAdd,
    timeout: 3000
  };
  $("#FormSvtStatusAdd").validate({
    submitHandler: function(form) {
      $(form).ajaxSubmit(options);
    },
    ignore: "",
    rules : {
      "svtstatus_name" : {required : 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/SvtStatusSave.ajax.php" method="post" name="FormSvtStatusAdd" id="FormSvtStatusAdd">
  <input id="svtstatus_id" name="svtstatus_id" type="hidden" value="{if isset($ArrSvtStatus.svtstatus_id)}{$ArrSvtStatus.svtstatus_id}{/if}" />
  <table>
    <tr>
      <td><label for="svtstatus_name">Наименование <span class="ui-state-error">* </span>:&nbsp;</label><span></span></td>
      <td><input type="text" id="svtstatus_name" name="svtstatus_name" value="{if isset($ArrSvtStatus.svtstatus_name)}{$ArrSvtStatus.svtstatus_name}{/if}" /></td>
    </tr>
    <tr>
      <td><label for="svtstatus_main">Отображать по умолчанию <span class="ui-state-error">* </span>:&nbsp;</label><span></span></td>
      <td><input type="checkbox" id="svtstatus_main" name="svtstatus_main"{if isset($ArrSvtStatus.svtstatus_main) && 1 eq $ArrSvtStatus.svtstatus_main} checked="checked"{/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>