SQLFORM.factory takes a Field or Table object, but auth.register() returns
a FORM object, so this won't work. You might consider simply adding the
extra field to the db.auth_user table, or you could add a field to the form
after it has been created (
http://web2py.com/books/default/chapter/29/7#Adding-extra-form-elements-to-SQLFORM
).
Anthony
On Thursday, May 31, 2012 6:42:56 AM UTC-4, frasse wrote:
>
> Hi
> I try to use SQLFORM.factory to add a row to other table when my user do
> the register form .
>
> I am doing this
> db.define_table(
> 'Player',
> Field('hash')
> )
> register_form = SQLFORM.factory( auth.register(),db.player)
> but it not working .
> the error is here
>
> SyntaxError: define_table argument is not a Field or Table: <form action=""
> enctype="multipart/form-data" method="post"><table><tr
> id="auth_user_first_name__row"><td class="w2p_fl"><label
> for="auth_user_first_name" id="auth_user_first_name__label">First name:
> </label></td><td class="w2p_fw"><input class="string"
> id="auth_user_first_name" name="first_name" type="text" value="" /></td><td
> class="w2p_fc"></td></tr><tr id="auth_user_last_name__row"><td
> class="w2p_fl"><label for="auth_user_last_name"
> id="auth_user_last_name__label">Last name: </label></td><td
> class="w2p_fw"><input class="string" id="auth_user_last_name"
> name="last_name" type="text" value="" /></td><td class="w2p_fc"></td></tr><tr
> id="auth_user_email__row"><td class="w2p_fl"><label for="auth_user_email"
> id="auth_user_email__label">E-mail: </label></td><td class="w2p_fw"><input
> class="string" id="auth_user_email" name="email" type="text" value=""
> /></td><td class="w2p_fc"></td></tr><tr id="auth_user_password__row"><td
> class="w2p_fl"><label for="auth_user_password"
> id="auth_user_password__label">Password: </label></td><td
> class="w2p_fw"><input class="password" id="auth_user_password"
> name="password" type="password" value="" /></td><td
> class="w2p_fc"></td></tr><tr id="auth_user_password_two__row"><td
> class="w2p_fl"><label>Verify Password: </label></td><td class="w2p_fw"><input
> name="password_two" type="password" /></td><td class="w2p_fc">please input
> your password again</td></tr><tr id="submit_record__row"><td
> class="w2p_fl"></td><td class="w2p_fw"><input type="submit" value="Register"
> /></td><td class="w2p_fc"></td></tr></table><div class="hidden"><input
> name="_next" type="hidden" value="/userweb/default/index" /><input
> name="_formkey" type="hidden" value="439f811e-9b38-4ecb-8b6b-2b6d9093cf67"
> /><input name="_formname" type="hidden" value="register" /></div></form>
>
> any Idea ?
>
> Thanks
> /Frasse
>
>