Awesome, thanks for the clarification, Anthony. I thought hidden fields 
were normal fields processed by SQLFORM. I used the code you gave me and it 
works great...hope others can benefit from it too. 

Thanks

On Thursday, June 21, 2012 6:33:29 PM UTC-7, Anthony wrote:
>
>     candidate_form = SQLFORM(db.candidate, candidate_record, 
>> hidden={'ownerUserId': candidate_record.ownerUserId})
>>
>>
>>     <input type="hidden" name="id" value="{{= candidate.id }}" />
>>
>
> First, shouldn't that be name="ownerUserId" and candidate.ownerUserId?
>
> Note, hidden fields are not really part of the form object and do not get 
> processed with the other form fields. They are merely added to the HTML 
> when the form is serialized in the view so the hidden field values come 
> back with the form submission. It is then up to you to do whatever you want 
> with those values manually. If you want them to be processed as regular 
> fields of the database table, I think you could do something like:
>
> candidate_form = SQLFORM(db.candidate, candidate_record,
>     hidden=dict(ownerUserId=candidate_record.ownerUserId))
> candidate_form.vars.ownerUserId = request.vars.ownerUserId
> candidate_form.process()
>
> Anyway, I think the other method might be better because you don't have to 
> bother including and manually manipulating hidden fields, and it won't 
> unnecessarily run validators on the non-updated fields.
>
> Anthony
>
>

-- 



Reply via email to