The problem is that the controller does:

if form.accepts(request.vars, session, keepvalues=True):

In my case, it throws an error saying the request.vars doesn't contain
a company_id for the SQLForm made using db.user. So I have to pass a
hidden form.custom.widget.company_id element to the view with its
_type set to "hidden". Therefore, it is in the HTML source code for
everyone to see, but it is not displayed in the browser window.

What I want to do is have it NOT show up in HTML source. I need to
somehow have the above validation succeed, but to do this I need to
insert the company_id into the request.vars as it is returned from
view on submit.

...help...




On Feb 18, 8:47 pm, Jonathan Lundell <jlund...@pobox.com> wrote:
> On Feb 18, 2010, at 8:25 PM, waTR wrote:
>
> > The only work-around I found was to mark all the required info as
> > hidden html, and so it now populates the request.vars with the stuff
> > it needs for the form to submit. This is not good for me though, as I
> > would really like to have only the data I want to change be passed to
> > the public html view. I want some of the data to stay private.
>
> Can you stick it in the session?
>
>
>
> > On Feb 18, 3:56 pm, waTR <r...@devshell.org> wrote:
> >> Also, I couldn't find a link to the epydocs ?  Where did that go?  It
> >> was really great!
>
> >> On Feb 18, 3:49 pm, waTR <r...@devshell.org> wrote:
>
> >>> I have created a form using SQLForm. I am using a db query to select a
> >>> single row from a db table, and I want to make changes to it. However,
> >>> when I submit, some of the data disapears in the submit. This happens
> >>> to also prevent the form from submitting as that data that disapears
> >>> is very important.
>
> >>> Here is what I have:
>
> >>> DB table "company" with fields name and title
> >>> DB table "user" with fields name and title, and a foreign key of
> >>> company id
>
> >>> When I use SQLForm(db.user, session.currentUserID) and submit this
> >>> form, the company_id field is null, even though before I submitted the
> >>> field in the DB has a 2 in it.  Note that I have not actually
> >>> generated the field in a view. So I imagine that any field that is not
> >>> in the view is submitted as NULL. Is this a bug?  I believe any field
> >>> that you don't use in a view should just be re-submitted with the same
> >>> data that was in the field before. Whats going on here? Why does the
> >>> field go empty?
>
> >>> Is there a way to manually set a value to the field before it submits?

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to