Quantcast
Channel: How to allow empty or numeric values in codeigniter's form_validation class? - Stack Overflow
Browsing all 6 articles
Browse latest View live

Answer by Ashish pathak for How to allow empty or numeric values in...

For phone number with 10 digits: $this->form_validation->set_rules('mobile', 'Mobile Number ', 'required|regex_match[/^[0-9]{10}$/]'); //{10} for 10 digits number

View Article



Answer by stealthyninja for How to allow empty or numeric values in...

But, it returns me the errorsThen perhaps an extra step:if (!empty($this->input->post('field[]'))){ $this->form_validation->set_rules('field[]', 'The field', 'numeric|xss_clean');}

View Article

Answer by Ogulcan Orhan for How to allow empty or numeric values in...

I think you mean "Using Arrays as Field Names"You can have a look at this page

View Article

Answer by Sam Granger for How to allow empty or numeric values in...

$this->form_validation->set_rules('field[]', 'The field', 'numeric|xss_clean');This should be sufficient in theory, since the field hasn't been set to required.

View Article

How to allow empty or numeric values in codeigniter's form_validation class?

I'd like to have input validated with form_validation class, that'll allow me to put numeric or empty value in the field.Something like this:$this->form_validation->set_rules('field[]','The...

View Article


Answer by Harunur Rashid for How to allow empty or numeric values in...

$this->form_validation->set_rules('field[]','The field','is_natural|trim|xss_clean');if ($this->form_validation->run() == FALSE) { $errors = $this->form_validation->error_array(); if...

View Article
Browsing all 6 articles
Browse latest View live


Latest Images