If I'm reading this 
correctly: 
http://web2py.com/books/default/chapter/29/07/forms-and-validators#Hide-errors

It looks like everything is now handled in the view and NOT the controller, 
so I'd need to do all of my checks in the view. Does that sound right?

On Tuesday, March 7, 2017 at 1:31:32 AM UTC-5, LoveWeb2py wrote:
>
> Thank you, Anthony, but I'm using a custom form via the "user" controller. 
>
> Here is my code
>
>  {{=form.custom.begin}}
> <div class="login-block">
>    <div class="input-group margin-bottom-20">
>       <span class="input-group-addon rounded-left"><i class="icon-user 
> color-blue"></i></span>
>                        
> {{form.custom.widget.username.update(_placeholder="Username")}}
>                        {{=form.custom.widget.username}}
>       <!--<input type="text" class="form-control rounded-right" 
> placeholder="Username">-->
>    </div>
>
>    <div class="input-group margin-bottom-20">
>       <span class="input-group-addon rounded-left"><i class="icon-lock 
> color-blue"></i></span>
>       <!--<input type="password" class="form-control rounded-right" 
> placeholder="Password">-->
>                        
> {{form.custom.widget.password.update(_placeholder="Password")}}
>                        {{=form.custom.widget.password}}
>
>    </div>
>
>    <div class="checkbox">
>       <ul class="list-inline">
>          <li>
>             <label>
>                <input type="checkbox"> Remember me
>             </label>
>          </li>
>
>          <li class="pull-right">
>             <a href="{{=URL('default','retrieve_password')}}">Forgot 
> password?</a>
>          </li>
>       </ul>
>    </div>
>
>    <div class="row margin-bottom-70">
>       <div class="col-md-12">
>                            {{=form.custom.submit}}
>          <!--<button type="submit" class="btn-u btn-u-blue btn-block 
> rounded">Sign In</button>-->
>       </div>
>    </div>
>
>    <div class="social-login text-center">
>       <div class="or rounded-x">Or</div>
>       <ul class="list-inline margin-bottom-20">
>          <li>
>             <button class="btn rounded btn-lg btn-facebook">
>                <i class="fa fa-facebook"></i> Facebook Sign in
>             </button>
>          </li>
>          <li>
>             <button class="btn rounded btn-lg btn-twitter">
>                <i class="fa fa-twitter"></i> Twitter Sign in
>             </button>
>          </li>
>       </ul>
>       <p>Don't have an account? <a 
> href="{{=URL('default','register')}}">Create New</a></p>
>    </div>
> </div>
>            {{=form.custom.end}}
>
>
> I tried putting the functions you mentioned in the process and validate 
> method in the "user" function, but still no luck.
>
> On Tuesday, March 7, 2017 at 12:39:18 AM UTC-5, Anthony wrote:
>>
>> See 
>> http://web2py.com/books/default/chapter/29/07/forms-and-validators#The-process-and-validate-methods
>>  
>> and 
>> http://web2py.com/books/default/chapter/29/07/forms-and-validators#Hide-errors
>> .
>>
>> After processing, errors are stored in form.errors (to get the error for 
>> a given field, use form.errors[fieldname]).
>>
>> Anthony
>>
>> On Tuesday, March 7, 2017 at 12:06:45 AM UTC-5, LoveWeb2py wrote:
>>>
>>> Hello,
>>>
>>> I have some custom login forms and I'm something like this:
>>>
>>>
>>> {{=form.custom.begin}}Image name: 
>>> <div>{{=form.custom.widget.name}}</div>Image file: 
>>> <div>{{=form.custom.widget.file}}</div>Click here to upload: 
>>> {{=form.custom.submit}}{{=form.custom.end}}
>>>
>>> How can I check for errors here?
>>>
>>> I'm lost at where form gets checked. For example, if the user types an 
>>> invalid password or username, I'd like to generate a custom message with 
>>> response.flash or something to that nature.
>>>
>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to