Mark error in form using Bootstrap

后端 未结 7 2230
隐瞒了意图╮
隐瞒了意图╮ 2020-12-07 07:52

I\'ve started using Bootstrap in order to achieve a nice page design without resorting to GWT (the backend is made in java)

For my login screen I copied this example

7条回答
  •  囚心锁ツ
    2020-12-07 07:59

    Bootstrap V3:

    Once i was searching for laravel features then i got to know this amazing form validation. Later on, i amended glyphicon icon features. Now, it looks great.

    The Email field is required.

    The Name field is required.

    The Check No. field is required.

    This is what it looks like:

    Once i completed it i thought i should implement it in Codeigniter as well. So here is the Codeigniter-3 validation with Bootstrap:

    Controller

    function addData()
    {
    $this->load->library('form_validation');
    $this->form_validation->set_rules('email','Email','trim|required|valid_email|max_length[128]');
    if($this->form_validation->run() == FALSE)
    {
    //validation fails. Load your view.
    $this->loadViews('Load your view','pass your data to view if any');
    }
    else
    {  
     //validation pass. Your code here.
    }
    }
    

    View

    '.form_error('email').''; $emailClass = $email_error; $emailIcon = ''; } else{ $emailClass = $emailIcon = $emailData = ''; } ?>

    Output:

提交回复
热议问题