Last active
November 10, 2017 19:22
-
-
Save miqueiaspenha/d3ce4fa45741bf09452148724bce1eed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
defined('BASEPATH') or exit('No direct script access allowed'); | |
class Welcome extends CI_Controller | |
{ | |
public function index() | |
{ | |
$this->form_validation->set_rules('quantidade', 'Quantidade', 'trim|required|min_length[5]|callback_checa_algo'); | |
if ($this->form_validation->run()) { | |
echo 'Cadastrado'; | |
die(); | |
} | |
$this->load->view('welcome_message'); | |
} | |
public function checa_algo($algo) | |
{ | |
if (!$algo) { | |
$this->form_validation->set_message('checa_algo', 'Formato de algo inválido.'); | |
return false; | |
} | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment