高新成 edited this page Nov 20, 2018 · 6 revisions

Custom form model

module app.form.LoginForm;

import hunt;

class LoginForm : Form
{
    mixin MakeForm;
     
    @Length(6,20)
    string username;
    
    @Length(8,16)
    string password;
}

Controller's Action

@Action
string login(LoginForm loginForm)
{
    auto result = loginForm.valid();
    // TODO
    if(!result.isValid)
    {
       logError("Valid error message : " ,result.messages());
    }
}
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.