{* Smarty *}

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

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

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

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

$(function() {
  var options = {
    success: showResponseFormPoAdd,
    timeout: 3000
  };
  $("#FormPoAdd").validate({
    submitHandler: function(form) {
      $(form).ajaxSubmit(options);
    },
    rules : {
      po_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/PoSave.ajax.php" method="post" name="FormPoAdd" id="FormPoAdd">
  <input id="po_id" name="po_id" type="hidden" value="{if isset($ArrPo.po_id)}{$ArrPo.po_id}{/if}" />
  <table>
    <tr>
      <td><label for="po_name">Наименование <span class="ui-state-error">* </span>:&nbsp;</label><span></span></td>
      <td><input type="text" id="po_name" name="po_name" value="{if isset($ArrPo.po_name)}{$ArrPo.po_name}{/if}" /></td>
    </tr>
    <tr>
      <td><label for="po_note">Примечание :&nbsp;</label><span></span></td>
      <td><textarea cols="50" rows="2" id="po_note" name="po_note">{if isset($ArrPo.po_note)}{$ArrPo.po_note}{/if}</textarea></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>