mirror of
https://github.com/claudehohl/Stikked.git
synced 2025-04-25 12:31:06 -05:00
validation fix
This commit is contained in:
parent
d0eca54435
commit
01aac16403
@ -30,7 +30,7 @@ class Main extends CI_Controller
|
||||
function _form_prep($lang = 'php', $title = '', $paste = '', $reply = false)
|
||||
{
|
||||
$this->load->model('languages');
|
||||
$this->load->helper("form");
|
||||
$this->load->helper('form');
|
||||
$data['languages'] = $this->languages->get_languages();
|
||||
$data['scripts'] = array(
|
||||
'jquery.js',
|
||||
@ -91,9 +91,22 @@ class Main extends CI_Controller
|
||||
{
|
||||
$this->load->model('pastes');
|
||||
$this->load->library('form_validation');
|
||||
$rules = array();
|
||||
$rules[]['code'] = 'required';
|
||||
$rules[]['lang'] = 'min_length[1]|required|callback__valid_lang';
|
||||
|
||||
//rules
|
||||
$rules = array(
|
||||
array(
|
||||
'field' => 'code',
|
||||
'label' => 'Your paste',
|
||||
'rules' => 'required'
|
||||
) ,
|
||||
array(
|
||||
'field' => 'lang',
|
||||
'label' => 'Language',
|
||||
'rules' => 'min_length[1]|required|callback__valid_lang'
|
||||
) ,
|
||||
);
|
||||
|
||||
//form validation
|
||||
$this->form_validation->set_rules($rules);
|
||||
$this->form_validation->set_message('min_length', 'The %s field can not be empty');
|
||||
$this->form_validation->set_error_delimiters('<div class="message error"><div class="container">', '</div></div>');
|
||||
|
@ -8,7 +8,8 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php if(isset($this->validation->error_string)){ echo $this->validation->error_string; }?>
|
||||
<?php echo validation_errors(); ?>
|
||||
|
||||
<div class="form_wrapper margin">
|
||||
<form action="<?php echo base_url(); ?>" method="post">
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user