I am experimenting with Lift for building a web application.
I read alot on the list on the ajax subject and I think I get more
familiar with.
I try to get a form submittet with ajax. I want an easy solution
without much
code writing. I tried the following suggestion as found here in the
list:
SHtml.ajaxForm(
bind("bookmark", xml,
"url" -> SHtml.text(url, url = _),
"submit" -> SHtml.submit("add", addBookmark)
) ++ SHtml.hidden(addBookmark)
)
I am using a StatefulSnippet. My little template:
<lift:surround with="default" at="col3">
<div id="addb">
<lift:Bookmark.add>
<bookmark:url />
<bookmark:submit />
</lift:Bookmark.add>
</div>
</lift:surround>
The form gets rendered but not submitted when the "add" button is
clicked.
I have a freshly build 1.1-snapshot and using simple-build-tool
(running jetty).
Do not understand it. Without Ajax it works.
with best regards
Br's,
Marius
<lift:Bookmark.add form="post">
Otherwise lift does not render for the form element.
Cheers, Tim
> --
>
> 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.
>
>
>
> You need to change the html to:
>
> <lift:Bookmark.add form="post">
>
> Otherwise lift does not render for the form element.
No the forms are rendered in html. I think the form="post" is only
needed when ajaxForm is not used.
But I see now in the Firebug Console that the liftajax cannot find
jQuery.
jQuery is not defined
http://localhost:8080/ajax_request/liftAjax.js
Line 157
jQuery is not defined
http://localhost:8080/bookmarks/add
Line 105
For the second error this is the generated JS in my html:
<script type="text/javascript">
104 // <![CDATA[
105 jQuery(document).ready(function() {liftAjax.lift_successRegisterGC
();});
106 var lift_page = "F1160735200508JPL";
107 // ]]>
108 </script>
The liftajax.js file is found.
The lift version I am using is a freshly build 1.1-snapshot of the
lift-base module.
with best regards
Without seeing more, its near impossible to debug.
Cheers, Tim
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
<title>Test</title>
<link type="text/css" rel="stylesheet" href="/css/my_layout.css">
</link>
<script type="text/javascript" src="/ajax_request/liftAjax.js">
</script>
</head>
This is the generated form in a simple div element:
<div id="addsf">
<form id="F392208970316G4M" action="javascript://"
onsubmit="lift_ajaxHandler(jQuery('#'+'F392208970316G4M').serialize(),
null, null);return false;">
<input type="text" name="F392208970313SOO" value=""/>
<input type="submit" name="F392208970314N0V" value="add"/>
<input type="hidden" name="F392208970315CPR" value="true"/>
</form>
</div>
And this is a generated script block at the bottom of the page:
<script type="text/javascript">
//
jQuery(document).ready(function() {lift_successRegisterGC();});
var lift_page = 'F392208970312QQE';
//
</script>
with best regards
You need to add:
<script type="text/javascript" src="/classpath/jquery.js"></script>
to your <head> element
Cheers, Tim
Ok I can workaround this by inserting a jquery reference, but I see
that jquery is in the lift sources.
The LiftBook states that by default the LiftRules.jsArtifacts variable
is
pointing to use jQuery by default.
with best regards
Lift does not inject jquery reference in html head. I don't think it
should as one could use Lift with YUI or other Lift framework. We
could probably create a small builtin snippet that does that but I
don't see lots of gains but probably would be helpful.
Br's,
Marius
I will post a comment on the liftbook group.
I will test it again with jQuery referenced.
with best regards
Thanks you guys.
with best regards
I dont think I have to take care to reference jQuery myself for lift.
Lift should insert the version it needs automatically.
--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.