SHtml.link should work like Shtml.submit

54 views
Skip to first unread message

dominikgr

unread,
Dec 10, 2009, 10:54:11 AM12/10/09
to Lift
Hallo
I have problem with SHtml.link. I want that it will work like
SHtml.submit. And the question is how can I made this. Thanks for
answer

David Pollak

unread,
Dec 10, 2009, 11:48:14 AM12/10/09
to lif...@googlegroups.com

What do you mean "work like"?  What does submit do that link doesn't?  What kind of behavioral differences are you unhappy about?
 

--

You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.





--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics
Message has been deleted

dominikgr

unread,
Dec 11, 2009, 3:16:19 AM12/11/09
to Lift
I meen that it doesn't save data from form to objects.
For example :
I have method for action link and submit like that :

def processSend() = {
var parameters = new Parameters
parameters.initialSearch = initialSearch

WebControler.actionSearch(parameters)
}

and now the part of bind function:

bind("form", ns,
"maxResponses" -> SHtml.text(initialSearch.maxResponses,
initialSearch.maxResponses = _),
//"submit" -> SHtml.link("", () => processSend(), button))
"submit" -> SHtml.submit("Search", processSend))

And the problem is that when I use link then new data for
initialSearch are not saved. But with submit works good.


On Dec 10, 5:48 pm, David Pollak <feeder.of.the.be...@gmail.com>
wrote:
> On Thu, Dec 10, 2009 at 7:54 AM, dominikgr <domini...@gmail.com> wrote:
> > Hallo
> > I have problem with SHtml.link. I want that it will work like
> > SHtml.submit. And the question is how can I made this. Thanks for
> > answer
>
> What do you mean "work like"?  What does submit do that link doesn't?  What
> kind of behavioral differences are you unhappy about?
>
>
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "Lift" group.
> > To post to this group, send email to lif...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > liftweb+u...@googlegroups.com<liftweb%2Bunsu...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/liftweb?hl=en.
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890

dominikgr

unread,
Dec 11, 2009, 3:16:06 AM12/11/09
to Lift
I meen that it doesn't save data from form to objects.
For example :
I have method for action link and submit like that :

def processSend() = {
var parameters = new Parameters
parameters.initialSearch = initialSearch

WebControler.actionSearch(parameters)
}

and now the part of bind function:

bind("form", ns,
"maxResponses" -> SHtml.text(initialSearch.maxResponses,
initialSearch.maxResponses = _),
//"submit" -> SHtml.link("", () => processSend(), button))
"submit" -> SHtml.submit("Search", processSend))

And the problem is that when I use link then new data for
initialSearch are not saved. But with submit works good.


On Dec 10, 5:48 pm, David Pollak <feeder.of.the.be...@gmail.com>
wrote:
> On Thu, Dec 10, 2009 at 7:54 AM, dominikgr <domini...@gmail.com> wrote:
> > Hallo
> > I have problem with SHtml.link. I want that it will work like
> > SHtml.submit. And the question is how can I made this. Thanks for
> > answer
>
> What do you mean "work like"?  What does submit do that link doesn't?  What
> kind of behavioral differences are you unhappy about?
>
>
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "Lift" group.
> > To post to this group, send email to lif...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > liftweb+u...@googlegroups.com<liftweb%2Bunsu...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/liftweb?hl=en.
>
> --
> Lift, the simply functional web frameworkhttp://liftweb.net
> Beginning Scalahttp://www.apress.com/book/view/1430219890

Marius

unread,
Dec 11, 2009, 3:40:54 AM12/11/09
to Lift
First of all please keep in mind that new members are moderated so
please have a little patience until you see your post.

If you want to submit a form by clicking a link from within the HTML
form that won't submit your form. It is an HTML behavior. However you
can have a form and an Ajax link so that when you click the link the
form is submitted via Ajax.

<a href="javascript:;" onclick={SHtml.submitAjaxForm("formId")}></a>

If you don't want Ajax, you can simply add the onclick event that
calls submit for a form.


Br's,
Marius

dominikgr

unread,
Dec 11, 2009, 4:01:36 AM12/11/09
to Lift
Sorry for the repetition of posts. And thanks for answer.
The last question how can I set form name, or form id when i use form
created in such way:

<lift:SearchForm.send form="POST" />

and binding start with bind("form", ns,


Marius

unread,
Dec 11, 2009, 4:50:20 AM12/11/09
to Lift
well if you want to use the approach below you can simply have in your
html:

<form id="ajaxy">
<lift:SearchForm>
// put your fields here
</lift:SearchForm>
</form>

In this approach we don't tell lift to generate a form but we wrap the
snippet into a form. Nonetheless this should also work:

<lift:SearchForm.send form="POST" id="myFormId"/>

Then put your link anywhere in your page.

Br's,
Marius

dominikgr

unread,
Dec 23, 2009, 5:16:30 AM12/23/09
to Lift
It works fine. Thanks a lot.
Reply all
Reply to author
Forward
0 new messages