>
> If I do have an Add button but I add the folowing after the grid creation:
>
> grid = SQLFORM.grid(db.place)
> for a in grid.elements('input',_name='mode'):# disable mode change. can 
> be done on a separate form
>     a['_disabled']=''
>
>
> to manipulate the html so the radio button will be disable on the edit/new 
> forms, then I can't add new records
> I get the new record form but clicking on submit the form stays and a 
> record is not added.
>

When you disable an HTML form input, the browser does not submit any value 
for that input (even if a value is selected, as in this case). As a result, 
the SQLFORM processing ends up setting the value to an empty string, which 
causes the default IS_IN_DB validator on the reference field to return an 
error complaining that the value is not in the database.

To avoid this problem, you can add the default value to request.post_vars 
before the grid is called:

    if 'new' in request.args and request.post_vars:
        request.post_vars.mode = 1

Include that before calling SQLFORM.grid.

I have also another issue (now that I have your attention:):
> Some times in my development process the session.flash functionality 
> changed so the flash message blinks a few times and disappears. Only a thin 
> line is left 
> in the color of the flash window. If I click on it it vanished exactly 
> like the flash window. Something similar is happening also to errors on a 
> form if I don't fill a field that is required then the red error message 
> blinks a few times and disappears. I get it all over the app also in the 
> login dialog, the e-mail requires blinks and vanished. If I click the login 
> button a few times the error message eventually stays..
>

No idea about that -- I've never seen it nor heard anyone else report that 
behavior.

Anthony

-- 
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/d/optout.

Reply via email to