REST - tbh never heard of it before but it looks interesting - thank
you.
On Oct 21, 8:37 pm, mdipierro <[EMAIL PROTECTED]> wrote:
> because I want T2 to follow REST (update/1). Form submission also POST
> (id=1&name=massimo&etc)
>
> On Oct 21, 1:44 pm, billf <[EMAIL PROTECTED]> wrote:
>
> > My understanding of the mechanism and yours seem exactly the same. My
> > question was WHY you designed the t2 update controller to expect a url
> > like
> > .../update/1 as opposed to .../update?id=1?
>
> > On Oct 21, 5:07 pm, mdipierro <[EMAIL PROTECTED]> wrote:
>
> > > Unless I misunderstand the question and I messed up this is how I
> > > think it works.
>
> > > 1) All t2 controllers that need a record id (update, delete, etc.)
> > > expect a url like ..../update/1 where args[-1] is the id of the
> > > record.
> > > There is no exception to this rule.
>
> > > 2) When you submit a form (create, update, etc) the variables are
> > > passed in the form. In the case of update the variables contain the
> > > hidden 'id'. This mechanism is inherited from SQLFORM. This may seem
> > > redundant but it is not. In fact in t2 you can change 1) and set your
> > > own t2.id so that you can create an update form based on a different
> > > criteria. In this case there is no id in the url but you still want to
> > > make sure SQLFORM knows what id the visitors thinks he/she is editing.
>
> > > Massimo
>
> > > On Oct 21, 9:46 am, billf <[EMAIL PROTECTED]> wrote:
>
> > > > When using the t2.update() method it seems mandatory that the id is
> > > > passed in initially as an argument (i.e. part of the path) but on
> > > > return from the update form it is expected as a parameter (i.e. ?id=1)
> > > > from a hidden input tag?
>
> > > > This seems to be the only example where an argument is expected. All
> > > > other form fields including stamp columns and formkey are passed as
> > > > parameters. I just wondered "why the exception"?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---