{* Smarty *}

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

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

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

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

$(function(){
  var options = {
    success: showResponseFormIpAdd,
    timeout: 3000
  };
  $("#FormIpAdd").validate({
    submitHandler: function(form) {
      $(form).ajaxSubmit(options);
    },
    ignore: "",
    rules : {
      "ip_name_b" : {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/IpRangeSave.ajax.php" method="post" name="FormIpAdd" id="FormIpAdd">
  <input id="ip_id" name="ip_id" type="hidden" value="{if isset($ArrIp.ip_id)}{$ArrIp.ip_id}{/if}" />
  <table>
    <tr>
      <td><label for="ip_name_b">Адреса с <span class="ui-state-error">* </span>:&nbsp;</label><span></span></td>
      <td><input type="text" id="ip_name_b" name="ip_name_b" value="" /></td>
    </tr>
    <tr>
      <td><label for="ip_name_e">Адреса по :&nbsp;</label><span></span></td>
      <td><input type="text" id="ip_name_e" name="ip_name_e" value="" /></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>