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. > 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. > 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. 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 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
