I remember I wrote another thread about this, and someone replied me
to write the codes. But I can't find the coding standard in Assembla,
so I write the codes with my style first.
2. test_1.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body class="lift:content_id=main">
<div id="main" class="lift:surround?with=default;at=content">
<div id="form" class="lift:TestForm?form=post">
<input id="submit" type="submit" value=" S U B M I T "/>
</div>
</div>
</body>
</html>
3. test_2.html (same with test_1.html but with the script in the
header )
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body class="lift:content_id=main">
<div id="main" class="lift:surround?with=default;at=content">
<head>
<script>
<script id="jquery" src="http://ajax.googleapis.com/ajax/libs/ jquery/1.6.1/jquery.min.js"
type="text/javascript"></script>
// <![CDATA[
jQuery(document).ready(function(){
jQuery("form").submit(function(){
jQuery(":submit").attr("disabled", "disabled");
});
});
// ]]>
</script>
</head>
<div id="form" class="lift:TestForm?form=post">
<input id="submit" type="submit" value=" S U B M I T "/>
</div>
</div>
</body>
</html>
4. My problem is, test_1 and test_2 calling the same StatefulSnippet
(TestForm), but in test_2 adding the script that prevents clicking
submit more than once, resulting the submit button doesn't work.
( Note : press submit in test_1.html I got the TEST message in
console, but not test_2.html )
Why? And what should I do to actually adding the javascript code to
work with Lift ?
/** * If you bind functions (i.e. using SHtml helpers) inside the closure passed to callOnce, * after your function is invoked, it will be automatically removed from functions cache so * that it cannot be invoked again. */ def callOnce[T](f: => T): T = { autoCleanUp.doWith(true) { f } }
<sailormoo...@gmail.com> wrote: > I remember I wrote another thread about this, and someone replied me > to write the codes. But I can't find the coding standard in Assembla, > so I write the codes with my style first.
> 2. test_1.html > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:// > www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > <html xmlns="http://www.w3.org/1999/xhtml"> > <body class="lift:content_id=main"> > <div id="main" class="lift:surround?with=default;at=content"> > <div id="form" class="lift:TestForm?form=post"> > <input id="submit" type="submit" value=" S U B M I T "/> > </div> > </div> > </body> > </html>
> 3. test_2.html (same with test_1.html but with the script in the > header ) > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:// > www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > <html xmlns="http://www.w3.org/1999/xhtml"> > <body class="lift:content_id=main"> > <div id="main" class="lift:surround?with=default;at=content"> > <head> > <script> > <script id="jquery" src="http://ajax.googleapis.com/ajax/libs/ > jquery/1.6.1/jquery.min.js" > type="text/javascript"></script> > // <![CDATA[ > jQuery(document).ready(function(){ > jQuery("form").submit(function(){ > jQuery(":submit").attr("disabled", "disabled"); > }); > }); > // ]]> > </script> > </head> > <div id="form" class="lift:TestForm?form=post"> > <input id="submit" type="submit" value=" S U B M I T "/> > </div> > </div> > </body> > </html>
> 4. My problem is, test_1 and test_2 calling the same StatefulSnippet > (TestForm), but in test_2 adding the script that prevents clicking > submit more than once, resulting the submit button doesn't work. > ( Note : press submit in test_1.html I got the TEST message in > console, but not test_2.html )
> Why? And what should I do to actually adding the javascript code to > work with Lift ?
> -- > You received this message because you are subscribed to the Google Groups "Lift" group. > To post to this group, send email to liftweb@googlegroups.com. > To unsubscribe from this group, send email to liftweb+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Thanks for the help, but I would like to ask the javascript code I
wrote is executed in the client first, and after that then it would be
posted to the server, why the server can't run the submit ?
Could you post a sample app that shows the problem?
Thanks
Diego Sent from my cell On Aug 24, 2011 5:13 AM, "sailormoo...@gmail.com" <sailormoo...@gmail.com> wrote:
> Thanks for the help, but I would like to ask the javascript code I > wrote is executed in the client first, and after that then it would be > posted to the server, why the server can't run the submit ?
> -- > You received this message because you are subscribed to the Google Groups "Lift" group. > To post to this group, send email to liftweb@googlegroups.com. > To unsubscribe from this group, send email to