Codeigniter 2 forms on one page, validation_errors problem

前端 未结 2 1495
野性不改
野性不改 2020-12-09 23:07

On one of my websites I have 2 forms on one page, I am having a problem, with validation_errors(); basically what is happening, is for one of the forms I am che

2条回答
  •  被撕碎了的回忆
    2020-12-09 23:48

    What I did was divide both forms. The view would be like

        
        
        
    //Inputs
    //Inputs

    Now, in the controller you can have two different functions for each validation:

        //Controller
        function some_action(){
        //validate form and code
        } 
    
        function other_action(){
        //validate form2 and code
        }
    

    Now, all validation messages will appear in the same place but will only show the messages of each form. Hope that helps

提交回复
热议问题