No, it's better to set the readable and writable attributes to False if you
want particular fields to be excluded from the form.
for fields in ['field1', 'field2', 'field3']:
db.auth_user[field].readable = db.auth_user[field].writable = False
form = auth.register()
Anthony
On Friday, January 3, 2014 9:01:39 AM UTC-5, Akash Agrawall wrote:
>
> Have to define all the attributes in custom form.... otherwise it won't
> run... wasn't doing the same..... define it as hidden if you don't want
> user to see them..... !!
>
> On Tuesday, December 31, 2013 5:54:34 PM UTC+5:30, Akash Agrawall wrote:
>>
>> Hie folks..... When I click on submit button of the CUSTOM REGISTRATION
>> form..... it redirects to the same page...... ?? No idea what this is
>> about......
>> Controller: default.py
>> def register():
>> form=auth.register()
>> form.add_button('Cancel', URL('register'))
>> if form.accepts(request.vars,session):
>> print "did it"
>> response.flash="Your Registration request has been
>> successfully submitted"
>> redirect(URL('home'))
>> elif form.errors:
>> response.flash="Errors in form"
>> else:
>> response.flash="nothing mah badd"
>> return dict(late=late, form=form)
>>
>> View: register.html
>> {{extend 'layout.html'}}
>> <a href={{=URL('home')}}>Home</a> ยป Book Connect
>> <p style="font-family:Times New Roman;font-size:17px;">
>> We facilitate sharing of books with partner Schools, NGOs, community
>> centers, and shelter homes.
>> <br/><br/>
>> In case you represent any of the above, please register with us as
>> partner to avail our book sharing program BookConnect. Once registered with
>> us, you can search through our book repository and request for the books.
>> </p>
>> <br/>
>> {{=form.custom.begin}}
>> <table>
>> <tr>
>> <td style="width:51%;">Name <span
>> style="color:red;">*</span></td><td> {{=form.custom.widget.Name}}</td>
>> </tr>
>> <tr>
>> <td style="width:51%;">Email <span
>> style="color:red;">*</span></td><td> {{=form.custom.widget.email}}</td>
>> </tr>
>> <tr >
>> <td style="width:51%">Password <span
>> style="color:red;">*</span></td><td> {{=form.custom.widget.password}}</td>
>> </tr>
>> <tr>
>> <td style="width:45%">Address <span
>> style="color:red;"></span></td><td> {{=form.custom.widget.Address}}</td>
>> </tr>
>> <tr>
>> <td style="width:45%">Contact Person <span
>> style="color:red;"></span></td><td>{{=form.custom.widget.Contact_person}}</td>
>> </tr>
>> <tr>
>> <td style="width:45%">Contact No 1 <span
>> style="color:red;">*</span></td><td>{{=form.custom.widget.Contact_No_1}}</td>
>> </tr>
>> <tr>
>> <td style="width:45%">Contact No 2 <span
>> style="color:red;"></span></td><td>{{=form.custom.widget.Contact_No_2}}</td>
>> </tr>
>> <tr>
>> <td style="width:45%">Description <span
>> style="color:red;"></span></td><td>{{=form.custom.widget.Description}}</td>
>> </tr>
>> <tr>
>> <td
>> style="width:45%">Website </td><td>{{=form.custom.widget.Website}}</td>
>> </tr>
>> <tr>
>> <td style="width:40%">Date of
>> Request</td><td>{{=form.custom.widget.Date_of_request}}</td>
>> </tr>
>> <tr style="visibility:hidden"><td
>> style="width:40%">Status</td><td>{{=form.custom.widget.Date_of_request}}</td></tr>
>> <tr><td>{{=form.custom.submit}}
>> <!--a class="btn btn-default"
>> href={{=URL('donate_book')}}>Cancel</a--></td></tr>
>> </table>
>> {{=form.custom.end}}
>>
>>
>> print form.errors -> <Storage {}>
>> pritn form.accepts(request.vars,session) -> false
>>
>
--
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.