Thanks for the reply @Antony.
When I posted this question on this Forum, i did not see it appear so I 
thought something must be wrong with google groups itself. Hence I posted 
on stackoverflow.

 
On Wednesday, January 11, 2017 at 5:35:18 AM UTC+5:30, Anthony wrote:
>
> FYI, already answered on SO: http://stackoverflow.com/a/41554743/440323
>
> Anthony
>
> On Tuesday, January 10, 2017 at 6:07:17 PM UTC-5, Rahul Priyadarsi wrote:
>>
>> Here is my db.py:
>>
>> db.define_table('antenna_details',
>>                 Field('antenna_name',required=True),
>>                 Field('model_name',required=True),
>>                 Field('project_name',required=True),
>>                 Field('frequency_band',required=True),
>>                 Field('polarization',required=True),
>>                 Field('aperture_size',required=True),
>>                 Field('fixer_availability',required=True),
>>                 Field('weight',required=True),
>>                 Field('material',required=True),
>>                 
>> Field('email_id',required=True,unique=True,requires=[IS_NOT_IN_DB]),
>>                 Field('subject',type='text',required=True),
>>                 Field('attached',type='upload', label="""
>>                     Antenna/feed Geometry
>>                     Electrical specification
>>                     Attach Simulated data in predicted form
>>                 """)
>> )
>>
>> db.antenna_details.email_id.requires=[IS_EMAIL(),IS_NOT_EMPTY()]
>> db.antenna_details.attached.requires=IS_NOT_EMPTY()
>> db.antenna_details.subject.rquires=IS_NOT_EMPTY()
>> db.antenna_details.material.requires=IS_NOT_EMPTY()
>> db.antenna_details.weight.requires=IS_NOT_EMPTY()
>> db.antenna_details.fixer_availability.requires=IS_NOT_EMPTY()
>> db.antenna_details.aperture_size.requires=IS_NOT_EMPTY()
>> db.antenna_details.polarization.requires=IS_NOT_EMPTY()
>> db.antenna_details.frequency_band.requires=IS_NOT_EMPTY()
>> db.antenna_details.project_name.requires=IS_NOT_EMPTY()
>> db.antenna_details.model_name.requires=IS_NOT_EMPTY()
>>
>>
>> And I am using SQLFORM to create a form for it:
>>
>> def index():
>>     """
>>     example action using the internationalization operator T and flash
>>     rendered by views/default/index.html or views/generic.html
>>
>>     if you need a simple wiki simply replace the two lines below with:
>>     return auth.wiki()
>>     """
>>     # response.flash = T("Hello World")
>>     # return dict(message=T('Welcome to web2py!'))
>>
>>     form = SQLFORM(db.antenna_details).process()
>>
>>     if form.process().accepted:
>>         response.flash = 'your data is posted'
>>
>>     return dict(form=form)
>>
>> My problem is that when I submit a form with duplicate email id(that 
>> already exists in db), instead of redirecting back to form and showing the 
>> error, it generates a ticket like this:
>>
>> <class 'sqlite3.IntegrityError'> column email_id is not unique
>>
>> While if I submit with empty fields, it simply redirects to the form and 
>> shows errors besides the respective input tags in red.
>> Why is it happening like this for email_id field only? And how do I 
>> disable this to show error messages in form itself?
>>
>

-- 
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