Welcome Guest, Not a member yet? Register   Sign In
Form validation in different controllers
#1

I want to make different controllers to show form and validate form, but at the same time i want to be able to show a validation message.
So for instance i  want to have a log in form two different places 
1) special page: site/login
2) anywhere on the site in the right top corner of the page 

And i want to share validation logic between them.
So i want two this forms send data on the same controller 
POST - user/validate
And at the same time if password is incorrect (or something else) show a validation error (in different places).


And second part of my question is How can i implement forms with validation on the one page.
Let's imagine a situation.

It's something like a forum - and i have 3 forms on one page -
1) mini login in the right top corner of the page.
2) main form for submitting your post
3) additional post for commenting system

And i wanna validate data from those forms (of course on the different controllers to avoid code duplication) and show validation error on the needed form (so if the password is wrong show it near the form, when you can write a password in, and on the form where you writing a commentary). 
And simultaneously how don't lose entered information? (or is it impossible and you need to implement using JavaScript and store data temporally in cookies?)
Reply


Messages In This Thread
Form validation in different controllers - by glorsh66 - 05-05-2018, 08:44 AM



Theme © iAndrew 2016 - Forum software by © MyBB