Answering my own question, I tried creating a matching SELECT, INPUT, etc. 
for my FORM object, and that did automatically hook up the server side 
validation. The code behind all this is pretty unwieldy. Is there some sort 
of best practice for creating form elements on the client in web2py?

-Shawn

On Saturday, September 14, 2013 9:33:44 PM UTC-4, Shawn Wheatley wrote:
>
> I'm working on an app with a master/detail-style view with a number of 
> detail lines that can be increased on the client. Right now, I'm using 
> jQuery to clone the table row of controls above and renaming the form 
> elements (named following a pattern of "item___001", "item___002", etc.) 
>  This works great, except now I need to hook up validation to my form as 
> well. If the elements are added server side (for example, on my edit/update 
> action when I read from the DB, I create a row of form elements for every 
> item returned) this all works fine. But my client side clone is not 
> properly hooking up the elements for server side validation when I submit.
>
> I think I read in another thread that the post variables (or rather, the 
> names of the form elements) must match those of a form helper object on the 
> server. So, if I have added a <select> with the name "item___003", I would 
> need to have a SELECT() with the same name on the server side. My question 
> is, what's the correct way to create this object? Do I add it anywhere on 
> the FORM() and just make it hidden? If the validation fails, I don't want 
> to end up somehow with my client and server representations of this form 
> element out of sync somehow.
>
> -Shawn
>

-- 
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/groups/opt_out.

Reply via email to