<?php echo form_open(current_url(),'class="form-horizontal"');?>
  <div class="form-group">
    <label class="col-sm-2 control-label">Nama</label>
    <div class="col-sm-10">
      <input class="form-control" type="text" name="nama" id="nama" value="<?php echo set_value('nama', $kategori->bk_nama);?>" maxlength="64" required="required"/>
    </div>
  </div>
  <div class="form-group">
    <label class="col-sm-2 control-label">Slug</label>
    <div class="col-sm-10">
      <input class="form-control" type="text" name="slug" id="slug" value="<?php echo set_value('slug', $kategori->bk_slug);?>" maxlength="64"/>
    </div>
  </div>
  <div class="form-group" style="margin-bottom: 0;">
    <div class="col-sm-offset-2 col-sm-10">
      <button class="btn btn-primary" type="submit">Simpan</button>
      <a class="btn btn-default" href="<?php echo site_url('admin/modules/blog/kategori');?>" data-dismiss="modal">Batal</a>
    </div>
  </div>
<?php echo form_close();?>
<script>
function convertToSlug(Text)
{
    return Text
        .toLowerCase()
        .replace(/[^\w ]+/g,'')
        .replace(/ +/g,'-')
        ;
}
$(document).on("input","#nama", function () {
    $("#slug").val(convertToSlug($("#nama").val()));
});
</script>
