It's out :) Br's, Marius
On Aug 25, 9:45 pm, "marius d." <[email protected]> wrote: > On Aug 25, 9:26 pm, David Pollak <[email protected]> > wrote: > > > > > On Tue, Aug 25, 2009 at 11:09 AM, marius d. <[email protected]> wrote: > > > > David, > > > > The action attribute is no different than class, id and target > > > attributes currently supported when lift is magically building the > > > form tag around the snippet content. My other notes inline. > > > > Br's, > > > Marius > > > > On Aug 25, 8:11 pm, David Pollak <[email protected]> > > > wrote: > > > > On Tue, Aug 25, 2009 at 9:46 AM, marius d. <[email protected]> > > > wrote: > > > > > > The topic was brought up in the discussion. > > > > > > Br's, > > > > > Marius > > > > > > On Aug 25, 7:32 pm, David Pollak <[email protected]> > > > > > wrote: > > > > > > On Tue, Aug 25, 2009 at 9:23 AM, marius d. <[email protected]> > > > > > wrote: > > > > > > > > 1. I just pushed a little change that allows: > > > > > > > > <lift:MySnippet form="post" action="/search"> > > > > > > > ... > > > > > > > </lift:MySnippet> > > > > > > > > 2. You can also do > > > > > > > > <form method="post" action="/search"> > > > > > > > <lift:mysnippet> > > > > > > > > <f:inputSearch/> > > > > > > > <f:submit/> > > > > > > > > </mysnippet> > > > > > > > > </form> > > > > > > > I'm not overly keen on the change (I'm not asking for it to be > > > removed). > > > > > > The reason for the "form" attribute was that it's common to do > > > postbacks > > > > > and > > > > > > the generation of S.uri as part of the URL was a bunch of > > > boilerplate. > > > > > > This commit does not contradict this rule. People can use action only > > > > > if they really need to without the boiler plate of typing the form > > > > > tag. > > > > > Right, but it's a place where Lift is mutating the result of the snippet > > > > call. This should only be done if there is a compelling reason. I see > > > no > > > > compelling reason here. This case is a fringe case and can easily be > > > > handled with a static form tag. The reason for the form attribute is > > > that > > > > it's the common case for wrapping a snippet in a post-back form and the > > > URL > > > > of the postback would require yet another snippet to calculate... and > > > > the > > > > feature made it into Lift before attribute snippets. > > > > > So, the rules are: (1) Lift does not mutate what the snippet returns > > > except > > > > under extremely compelling situations and (2) we don't add "reserved > > > word" > > > > attributes except under compelling situations. > > > > > > > That's the reason I made the exception to the "snippets result in > > > > > whatever > > > > > > is returned from the snippet rather than having magic intervention" > > > rule. > > > > > > I really don't see how this implies a "magic intervention" since all > > > > > this applies only if user explicitly adds action attribute. I mean if > > > > > users explicitly points to a new page they expect that page to be > > > > > rendered naturally which is what is happening. > > > > > Except for the "form='xxx'" attribute, I know of no other attribute > > > that's > > > > baked into Lift's snippet handling mechanism. The use of this attribute > > > is > > > > the only time that I know of that Lift's snippet handler mutates the > > > result > > > > of the snippet by putting a <form/> tag around it. > > > > > In all other cases, it's up to the snippet itself to interpret the > > > > attributes. If we keep adding attributes that cause something to happen > > > if > > > > the attribute appears, it will reduce the attributes available for use > > > > by > > > > snippets themselves. > > > > > > > In the future, let's not mutate what the snippet returns without a > > > > > > discussion and a very strong justification. > > > > > > I really don't see the problem. The form attribute tells the user that > > > > > a form will be rendered. Since a form will be rendered why can't the > > > > > user change the action in exceptional cases since this doesn't induce > > > > > side effects. If it does please let me know what are those side > > > > > effects. > > > > > It removes an attribute that's available for generic use by snippets. > > > > If > > > > there's code out there that uses the action attribute as part of the > > > > snippet, what are the impacts on that snippet? > > > > There is no impact really. Current behavior is not altered in any way. > > > If user uses the action attribute he/she explicitly tells "I just what > > > to got to this URI instead of the default one". If user doesn't use > > > action attribut it'll render S.uri as it currently does. If there are > > > form snippets out there using the action attribute has no impact of > > > the snippet per se but we'll put that value to the action of the form > > > which indeed will not be ok. Still I really doubt that there are > > > snippets using form attribute that uses action attribute for a > > > different meaning that for a normal html form. Same question can apply > > > for current supported attributed class, id and target and that's ok. I > > > haven't seen people complaining that they use the class attribut > > > expressing something else then a CSS class. I think people are very > > > comfortable and knowledgeable in terms of HTML semantics and they just > > > don't mix these semantics with something else. > > > I was unaware of these attributes being co-opted by the form handler. Under > > the standard: > > > (1) Lift does not mutate what the snippet returns except under extremely > > compelling situations and (2) we don't add "reserved word" attributes except > > under compelling situations. > > > The copying of id and class (and probably style) would meet the test. It's > > extremely compelling because almost every form element will have a class > > and/or style attribute. Many will have an id attribute. > > > The number of times one has a target of a post-back is limited and I would > > have objected to the use of the "target" attribute in this case. > > target attribute was needed for a concrete case. Ajax like file > upload. Because we can't upload files via Ajax the trick is to use a > hidden iframe and set the target for the form. This has been quite > helpful > > > > > I still object to this change (although I am not asking you to back it > > out.) Altering the action attribute of the form is not compelling. It's a > > fringe use-case with a very simple work-around. > > > I am setting down the explicit rule that any other changes to the way we > > handle this special case and any time that we reserve an attribute (whether > > or not it makes sense from an HTML perspective), I expect that there will be > > a lot more discussion and analysis. > > I feel that this is a much more subjective discussion then an > objective one. As you have such strong feelings about the matter I > will back it out as I care more about Lift then some egocentric > motivation and I really don't feel comfortable fighting for such minor > things. > > > > > David > > > > > > If you want to I have no problem removing it but I really don't see > > > > > what the issue is. > > > > > > > Thanks, > > > > > > > David > > > > > > > > In both cases you can use Lift's html abstractions such as > > > SHtml.text > > > > > > > etc. and bind your function. In the second example we used a > > > snippet > > > > > > > that has no idea about form ... it is just wrapped by a form. So > > > > > > > in > > > > > > > both cases you don't really need to call S.attr to manually get > > > > > > > parameters. > > > > > > > > Br's, > > > > > > > Marius > > > > > > > > On Aug 25, 6:24 pm, David Pollak <[email protected]> > > > > > > > wrote: > > > > > > > > On Tue, Aug 25, 2009 at 12:38 AM, Ulises < > > > [email protected]> > > > > > > > wrote: > > > > > > > > > > Hey people, > > > > > > > > > > I'm trying to have a form be submitted to a different page > > > > > > > > > (so, > > > not > > > > > a > > > > > > > > > POST/GET back). The scenario is a search form which renders on > > > a > > > > > front > > > > > > > > > page as well as on the search page. > > > > > > > > > > E.g.: > > > > > > > > > > /index > > > > > > > > > should include a form that submits to /search > > > > > > > > > > /search > > > > > > > > > form that submits to itself > > > > > > > > > <form method="post" action="/search"><input type="text" > > > name="search" > > > > > > > > value=""/><input type="submit" value="Search"/></form> > > > > > > > > > In the snippet that handles the search page: > > > > > > > > > val searchTerm = S.param("search") openOr {S.error("no search > > > term"); > > > > > > > > S.redirectTo(S.referer openOr "/")} > > > > > > > > > > Any hints on how to do this/were to look to learn how to do > > > this? I > > > > > > > > > guess that the form on the front page could be just static > > > > > > > > > HTML > > > > > > > > > however I'm not entirely sure how /search would deal with the > > > form > > > > > > > > > submission from a static form ... > > > > > > > > > > Cheers, > > > > > > > > > > Ulises > > > > > > > > > -- > > > > > > > > Lift, the simply functional web frameworkhttp://liftweb.net > > > > > > > > Beginning Scalahttp://www.apress.com/book/view/1430219890 > > > > > > > > Follow me:http://twitter.com/dpp > > > > > > > > Git some:http://github.com/dpp > > > > > > > -- > > > > > > Lift, the simply functional web frameworkhttp://liftweb.net > > > > > > Beginning Scalahttp://www.apress.com/book/view/1430219890 > > > > > > Follow me:http://twitter.com/dpp > > > > > > Git some:http://github.com/dpp > > > > > -- > > > > Lift, the simply functional web frameworkhttp://liftweb.net > > > > Beginning Scalahttp://www.apress.com/book/view/1430219890 > > > > Follow me:http://twitter.com/dpp > > > > Git some:http://github.com/dpp > > > -- > > Lift, the simply functional web frameworkhttp://liftweb.net > > Beginning Scalahttp://www.apress.com/book/view/1430219890 > > Follow me:http://twitter.com/dpp > > Git some:http://github.com/dpp --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Lift" 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/liftweb?hl=en -~----------~----~----~----~------~----~------~--~---
