Hi all,
with SQLFORM.factory allows you very easily to create form in order to 
insert data but when you have to edit the same form you will find many 
problems. Your idea of changing the default values is nice and actually 
could solve this lack but from my point of view it would be nice to have 
something better already built-in in  SQLFORM.factory. 

Cheers,
Paolo


On Wednesday, August 29, 2012 4:49:18 PM UTC+2, Marek Mollin wrote:
>
> Couple of ideas.
> There have been some hacks about just appending fields from one SQLFORM 
> with another.
> + Massimo answer but:
>
> I would recomend using SQLFORM.factory. You can add fields just using your 
> model.
>
> SQLFORM.factory(
> db.table.name,
> db.table.otherfield,
> db.anothertable.anotherfield,
> )
>
>
> If you want it to be edit/insert form.
> Prior to defining SQLFORM.factory change the defaults on those fields and 
> in both cases manually:
>
> db.table.name.default = db.table[request.args].name
>
> form = SQLFORM.factory(
> db.table.name,
> db.table.otherfield,
> db.anothertable.anotherfield,
> ) 
>
> if form.process().accepted:
>    //inserting or updating goeshere
>
> This way you keep all the validators and all the logic defined in models.
> You can choose fields that you want to use and those that you want to skip.
>
>
>
> W dniu środa, 29 sierpnia 2012 13:54:54 UTC+2 użytkownik Daniel Gonzalez 
> napisał:
>>
>> Hi,
>>
>> I have two forms which I am creating using SQLFORM. I need two forms 
>> because I want to style the presentation in such a way that the fields are 
>> distributed across the page using a specific layout.
>>
>> I want both forms to be presented to the user as a single form, with only 
>> one submit button.
>>
>> 1) Is it possible to do this?
>> 2) Can both forms then be validated in one single controller function?
>> 3) Can the data of both forms be submitted in one go?
>>
>> Thanks,
>> Daniel
>>
>

-- 



Reply via email to