Welcome Guest, Not a member yet? Register   Sign In
Setting the default value of an input.
#2

[eluser]ElShotte[/eluser]
Code:
//--Form Validation - Retired--//
                    //-----------------------------//
                    
                    if ($totaljobs == '4') {
                    
                    $ssinc    = $this->input->post('cossincome');
                    $pens    = $this->input->post('copension');
                    $ann    = $this->input->post('coannuity');
                    $reti    = $this->input->post('coretirement');
                    
                    if ((!empty($ssinc)) or (!empty($pens)) or (!empty($ann)) or (!empty($reti)))
                        {
                            $this->form_validation->set_rules('cossincome', 'Social Security', 'trim|numeric');
                            $this->form_validation->set_rules('copension', 'Pension', 'trim|numeric');
                            $this->form_validation->set_rules('coannuity', 'Annuity', 'trim|numeric');
                            $this->form_validation->set_rules('coretirement', 'Retirement', 'trim|numeric');
                        }
                    else
                        {    
                            $this->form_validation->set_rules('cossincome', 'Social Security', 'trim|required|numeric');
                            $this->form_validation->set_rules('copension', 'Pension', 'trim|required|numeric');
                            $this->form_validation->set_rules('coannuity', 'Annuity', 'trim|required|numeric');
                            $this->form_validation->set_rules('coretirement', 'Retirement', 'trim|required|numeric');
                        }
                    }    
                            
                    //-------End of Form Validation-------//
                    //------------------------------------//

In the controller of course.


Messages In This Thread
Setting the default value of an input. - by El Forum - 09-23-2009, 01:48 PM
Setting the default value of an input. - by El Forum - 09-23-2009, 03:39 PM



Theme © iAndrew 2016 - Forum software by © MyBB