Disabled fields in SQLFORM fail validation?

37 views
Skip to first unread message

lillian

unread,
Feb 28, 2015, 8:07:03 AM2/28/15
to web...@googlegroups.com
Hello,

I have a SQLFORM.factory-created form with several fields but one in particular that can only be filled out ONCE.  If the form is edited that particular field is disabled.  All that logic works fine.  However, when the edited form is submitted the disabled field fails validation even though it contained the original valid value.  After the failed submit it is empty.

I expect I could work around this - replace the input with a label instead of disabling it for example - but I'd rather know why disabled fields fail validation.  Are their contents inaccessible?  Making the field readonly solves the validation problem but raises others (the field still responds to clicks and other user input for example).

Thoughts?


lillian

unread,
Mar 4, 2015, 2:59:27 PM3/4/15
to web...@googlegroups.com

No suggestions or insight into this?  Anyone?

Anthony

unread,
Mar 4, 2015, 4:39:43 PM3/4/15
to web...@googlegroups.com
Hard to say without seeing any code.

黄祥

unread,
Mar 5, 2015, 2:29:06 AM3/5/15
to web...@googlegroups.com
perhaps you can add the field for counter and increase whenever the table is edit (onupdate), and then using conditional if to check if counter > 1 then field.writable = False

best regards,
stifan
Reply all
Reply to author
Forward
0 new messages