[Lift] Re: javascript with an ajaxbutton
I don't think i can pull a small example from here because I'm combining my lack of knowledge in scala, lift, html, jquery, tinyMCE ... you get the idea. The point is that I am trying to create a button that calls a scala function and a javascript function. I am currently trying to use an shtml.ajaxButton, though I don't know if that is the right tool. Button: save1 - SHtml.ajaxButton( Fixed, { () = { println(Fixed scala/lift.); saveClaimStatus(FIXED); //scala function. works as intended JsRaw($.saveT();).cmd); } }) javascript function: function saveT () { document.form[0].submit(); }; In the 42 different ways I have tried to implement this, I can get one or the other to function, but i cannot get both to work. How do I do both functions with one button? Thanks. And I'm sorry if I'm not explaining this correctly, or that it's not making much sense. -Chris On Oct 20, 2:31 pm, Marius marius.dan...@gmail.com wrote: I was hoping to see something minimalistic and isolated so I can quickly try it out. I'm not sure what you do with redirect(/workflow/claims) but from Ajax function you should probably use JsCmd.RedirectTo .. Hopefully I'll have some time this weekend to play with tinyMCE Br's, Marius On Oct 19, 10:57 pm, caw1461 caw1...@gmail.com wrote: edit.html: script type=text/javascript tinyMCE.init({ // General options mode : textareas, theme : advanced, plugins : spellchecker,pagebreak,save,advhr,advimage,advlink,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,noneditable,visualchars,nonbreaking,xhtmlxtras,template, theme_advanced_buttons1 : styleselect,formatselect,fontselect,fontsizeselect,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|, hr, bullist,numlist, preview, code, theme_advanced_buttons2 : , theme_advanced_buttons3 : , theme_advanced_buttons4 : , submit_patch : false, theme_advanced_resizing : true }); // The save function that actually works. $.saveFunc = function() { tinyMCE.activeEditor.save() }; function saveT () { console.log(javascriptconsole 1) tinyMCE.activeEditor.save() console.log(javascriptconsole 2) }; $('#fixed').click(function(e){ tinyMCE.activeEditor.save() }); /script editor:text/ br/ !-- NOW WORKS CORRECTLY -- button id=Save onclick=saveT() class=ui-state-default title=Save, only save the html, doesn't mark the claim ready for publishging.Save/button editor:save1/ editor:cancel/ editor:save2/ //*// Workflow.scala: SHtml.ajaxForm( bind(editor, xhtml, text - SHtml.textarea(originalOrEditedFileAsString (selectedClaimWorkQueue.open_!.fileName), s = { println(s) saveClaimHtmlToDB(s) saveClaimHtml(s, selectedClaimWorkQueue.open_!.fileName) S.notice(Submitted.) redirect(/workflow/claims) } , (style, height: 500px; width:97%), (id, mceForm)), save - SHtml.ajaxButton( Save, {() = Log.info(Got a 'save' AJAX call) saveClaimStatus(EDITED) S.notice(Saved.) redirect(/workflow/claims) }, (type, submit),(class, ui-state-default ), (title, Save, only save the html, does not mark the claim ready for publishging.), (id, fixed)), save1 - SHtml.ajaxButton( Fixed, { () = { println(Fixed scala/lift.); saveClaimStatus(FIXED); JsRaw($.saveFunc();).cmd); } }, (class, ui-state-default ), (title, Save and marks the claim ready for publishing.), (id, fixed)), save2 - SHtml.ajaxButton( yes, () = {JsRaw($.saveFunc();).cmd }))) } I'm already importing both of those so that isn't the problem. If I put a % (onclick - saveT()) on the button, it saves the way I want it to, but it does not do any of the println or saveClaimStatus calls. I just want it to do both. On Oct 19, 3:43 pm, Marius marius.dan...@gmail.com wrote: I think with an import net.liftweb.http.js._ import JsCmds._ the compile problem should go away as there is an implicit defined there. But this is not important. Can you send a minimalistic code example that reflects the problem? ... including the template and Scala code. Br's,
[Lift] Re: javascript with an ajaxbutton
I'm sorry that I haven't had the time to try it out myself yet. If you want the scala function to be called via an Ajax request and after that the Scala function returns the Javascript that calls your JS function, your code looks correct to me. I used this pattern quite a bit with no problems. So the flow here is: 1. When pressing the button the Ajax request is sent to server 2. On server side Lift executes your scala function which returns a JsCmd 3. Lift returns your JsCmd as a JavaScript code that will be executed by the browser. .. so the order here is Scala function and then JavaScipt function, Now if you want your JavaScript function to be called first and then the Scala function then you have this method in SHtml: /** * Create an Ajax button. When it's pressed, the function is executed * * @param text -- the name/text of the button * @param jsFunc -- the user function that will be executed. This function will receive as last parameter * the function that will actually do the ajax call. Hence the user function can decide when * to make the ajax request. * @param func -- the function to execute when the button is pushed. Return Noop if nothing changes on the browser. * * @return a button to put on your pagejsFunc.params ++ List(AnonFunc (makeAjaxCall(Str(name+=true */ def ajaxButton(text: NodeSeq, jsFunc: Call, func: () = JsCmd, attrs: (String, String)*) jsFunc is any JavaScript function that may receive any number of parameters. Lets say it is defined like: function f(x, y, z) { } When the ajax button is pressed, your function f is called as f(x, y, z, fnc) ... so at the call time your function received another parameter ... a fnc. This is simply a function that you may or may not decide to call in your f function. This fnc encapsulates the actual ajax call. The Call class is defined as: case class Call(function: String, params: JsExp*) extends JsExp inside JE object As an example: ajaxButton(text, Call(myFunc, 10, 20, 30), () = /*return the JavaScript respose as a JsCmd*/) somewhere in your javascript code you have function myFunc(x, y, z, ajaxCall) { // do some computation ajaxFunc(); } Note that I specified the ajaxCall in the JS function but not when specifying the Call instance. That's because Lift generates for you the actual call to myFunc when pressing the ajaxButton This will call your javascript function and then the ajax call, but you also have the control to not make the ajax call at all depending on how you implement you JS function. Hope this helps. Br's, Marius On Oct 22, 8:19 pm, caw1461 caw1...@gmail.com wrote: I don't think i can pull a small example from here because I'm combining my lack of knowledge in scala, lift, html, jquery, tinyMCE ... you get the idea. The point is that I am trying to create a button that calls a scala function and a javascript function. I am currently trying to use an shtml.ajaxButton, though I don't know if that is the right tool. Button: save1 - SHtml.ajaxButton( Fixed, { () = { println(Fixed scala/lift.); saveClaimStatus(FIXED); //scala function. works as intended JsRaw($.saveT();).cmd); } }) javascript function: function saveT () { document.form[0].submit(); }; In the 42 different ways I have tried to implement this, I can get one or the other to function, but i cannot get both to work. How do I do both functions with one button? Thanks. And I'm sorry if I'm not explaining this correctly, or that it's not making much sense. -Chris On Oct 20, 2:31 pm, Marius marius.dan...@gmail.com wrote: I was hoping to see something minimalistic and isolated so I can quickly try it out. I'm not sure what you do with redirect(/workflow/claims) but from Ajax function you should probably use JsCmd.RedirectTo .. Hopefully I'll have some time this weekend to play with tinyMCE Br's, Marius On Oct 19, 10:57 pm, caw1461 caw1...@gmail.com wrote: edit.html: script type=text/javascript tinyMCE.init({ // General options mode : textareas, theme : advanced, plugins : spellchecker,pagebreak,save,advhr,advimage,advlink,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,noneditable,visualchars,nonbreaking,xhtmlxtras,template, theme_advanced_buttons1 : styleselect,formatselect,fontselect,fontsizeselect,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|, hr, bullist,numlist, preview, code, theme_advanced_buttons2 : , theme_advanced_buttons3 : , theme_advanced_buttons4 : , submit_patch : false, theme_advanced_resizing : true });
[Lift] Re: javascript with an ajaxbutton
I was hoping to see something minimalistic and isolated so I can quickly try it out. I'm not sure what you do with redirect(/workflow/claims) but from Ajax function you should probably use JsCmd.RedirectTo .. Hopefully I'll have some time this weekend to play with tinyMCE Br's, Marius On Oct 19, 10:57 pm, caw1461 caw1...@gmail.com wrote: edit.html: script type=text/javascript tinyMCE.init({ // General options mode : textareas, theme : advanced, plugins : spellchecker,pagebreak,save,advhr,advimage,advlink,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,noneditable,visualchars,nonbreaking,xhtmlxtras,template, theme_advanced_buttons1 : styleselect,formatselect,fontselect,fontsizeselect,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|, hr, bullist,numlist, preview, code, theme_advanced_buttons2 : , theme_advanced_buttons3 : , theme_advanced_buttons4 : , submit_patch : false, theme_advanced_resizing : true }); // The save function that actually works. $.saveFunc = function() { tinyMCE.activeEditor.save() }; function saveT () { console.log(javascript console 1) tinyMCE.activeEditor.save() console.log(javascript console 2) }; $('#fixed').click(function(e){ tinyMCE.activeEditor.save() }); /script editor:text/ br/ !-- NOW WORKS CORRECTLY -- button id=Save onclick=saveT() class=ui-state-default title=Save, only save the html, doesn't mark the claim ready for publishging.Save/button editor:save1/ editor:cancel/ editor:save2/ //*// Workflow.scala: SHtml.ajaxForm( bind(editor, xhtml, text - SHtml.textarea(originalOrEditedFileAsString (selectedClaimWorkQueue.open_!.fileName), s = { println(s) saveClaimHtmlToDB(s) saveClaimHtml(s, selectedClaimWorkQueue.open_!.fileName) S.notice(Submitted.) redirect(/workflow/claims) } , (style, height: 500px; width:97%), (id, mceForm)), save - SHtml.ajaxButton( Save, {() = Log.info(Got a 'save' AJAX call) saveClaimStatus(EDITED) S.notice(Saved.) redirect(/workflow/claims) }, (type, submit),(class, ui-state-default ), (title, Save, only save the html, does not mark the claim ready for publishging.), (id, fixed)), save1 - SHtml.ajaxButton( Fixed, { () = { println(Fixed scala/lift.); saveClaimStatus(FIXED); JsRaw($.saveFunc();).cmd); } }, (class, ui-state-default ), (title, Save and marks the claim ready for publishing.), (id, fixed)), save2 - SHtml.ajaxButton( yes, () = {JsRaw($.saveFunc();).cmd }))) } I'm already importing both of those so that isn't the problem. If I put a % (onclick - saveT()) on the button, it saves the way I want it to, but it does not do any of the println or saveClaimStatus calls. I just want it to do both. On Oct 19, 3:43 pm, Marius marius.dan...@gmail.com wrote: I think with an import net.liftweb.http.js._ import JsCmds._ the compile problem should go away as there is an implicit defined there. But this is not important. Can you send a minimalistic code example that reflects the problem? ... including the template and Scala code. Br's, Marius On Oct 19, 9:48 pm, caw1461 caw1...@gmail.com wrote: My saveClaimSatus() function saves the passed value to the database. Firebug is not giving me any errors and prints the line to the console. The order in which the two updates happen is important because I need the status updated before the form is saved. I am using two different versions of saving to keep a temporary save and then a finalized For Publish version. so I need both of them to save the form, which i was trying to use the saveFunc to do. and removing the .cmd seems to give a syntax errors: E:\patentTracker3\prospective_claims_ver_br\patentTrackerUi\src\main \scala\com\trlr\binpr\snippet\Workflow.scala:473: error: overloaded method value ajaxButton with alternatives (String,() = net.liftweb.http.js.JsCmd,(String, String)*)scala.xml.Elem and (scala.xml.NodeSeq,() = net.liftweb.http.js.JsCmd,(String, String)*) scala.xml.Elem cannot be applied to (java.lang.String,() = net.liftweb.http.js.JE.JsRaw,(java.lang.String, java.lang.String), (java.lang.String, java.lang.String),(java.lang.String, java.lang.String)) save1 -
[Lift] Re: javascript with an ajaxbutton
I think you can simply return JsRaw($.saveFunc();) without using JsRaw($.saveFunc();).cmd Do you see any errors in the browser? ... try using firebug addon in firefox and see if it complains about anything. What does saveClaimStatus(EDITED) do? Regarding I'm just trying to run a javascript function followed by my saveClaimStatus(EDITED) function. ... when you press the button that ajax function on the server side gets executed and it returns a JavaScript back to browser where $.saveFunc() suppose to be executed. In your code saveClaimStatus is run before running $saveFunc() in the case of the save1 button which seems to be the other way around. What is your actual use case? Br's, Marius On Oct 19, 8:29 pm, caw1461 caw1...@gmail.com wrote: I figured this was a simple problem, but have spent way too much time on this issue. $.saveFunc = function() { saveT(); }; function saveT () { print(save function executing) tinyMCE.activeEditor.save() print(save completed) }; button id=Save onclick=saveT() class=ui-state-default title=Save, only save the html, doesn't mark the claim ready for publishging.Save/button as a pure javascript/html, this works as intended, the button saves/ submits the form. save1 - SHtml.ajaxButton( Fixed, { () = { println(Jenn is on crack.); saveClaimStatus(EDITED) JsRaw($.saveFunc();).cmd; } }, (class, ui-state-default ), (title, Save and marks the claim ready for publishing.), (id, fixed)), save2 - SHtml.ajaxButton( yes, () = {println(Rhode Island Destroyed) JsRaw($.saveFunc();).cmd}) I used your example in the other thread about ajaxbutton and javascript, but I can't get the functionality I am looking for. save2 is just a test button to check functionality. It does run the println, but it does not run the saveT function. 13:19:17.725 [29569...@qtp-6966554-8] DEBUG comet_trace.debug:82 - AJAX Request: 182kyt8t8rjdz Map(F527240256671NZ2 - List(true)) Rhode Island Destroyed 13:19:17.725 [29569...@qtp-6966554-8] DEBUG comet_trace.debug:82 - AJAX Response: 182kyt8t8rjdz InMemoryResponse( $.saveFunc();;, List((Content-Length,15), (Content-Type,text/ javascript; charset=utf-8)), List(), 200) I'm just trying to run a javascript function followed by my saveClaimStatus(EDITED) function. I just think i'm either not going about this correctly or not understanding my problem correctly. Any help would be a godsend. Thanks, Christopher --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: javascript with an ajaxbutton
My saveClaimSatus() function saves the passed value to the database. Firebug is not giving me any errors and prints the line to the console. The order in which the two updates happen is important because I need the status updated before the form is saved. I am using two different versions of saving to keep a temporary save and then a finalized For Publish version. so I need both of them to save the form, which i was trying to use the saveFunc to do. and removing the .cmd seems to give a syntax errors: E:\patentTracker3\prospective_claims_ver_br\patentTrackerUi\src\main \scala\com\trlr\binpr\snippet\Workflow.scala:473: error: overloaded method value ajaxButton with alternatives (String,() = net.liftweb.http.js.JsCmd,(String, String)*)scala.xml.Elem and (scala.xml.NodeSeq,() = net.liftweb.http.js.JsCmd,(String, String)*) scala.xml.Elem cannot be applied to (java.lang.String,() = net.liftweb.http.js.JE.JsRaw,(java.lang.String, java.lang.String), (java.lang.String, java.lang.String),(java.lang.String, java.lang.String)) save1 - SHtml.ajaxButton( On Oct 19, 2:20 pm, Marius marius.dan...@gmail.com wrote: I think you can simply return JsRaw($.saveFunc();) without using JsRaw($.saveFunc();).cmd Do you see any errors in the browser? ... try using firebug addon in firefox and see if it complains about anything. What does saveClaimStatus(EDITED) do? Regarding I'm just trying to run ajavascriptfunction followed by my saveClaimStatus(EDITED) function. ... when you press thebutton thatajaxfunction on the server side gets executed and it returns aJavaScriptback to browser where $.saveFunc() suppose to be executed. In your code saveClaimStatus is run before running $saveFunc() in the case of the save1buttonwhich seems to be the other way around. What is your actual use case? Br's, Marius On Oct 19, 8:29 pm, caw1461 caw1...@gmail.com wrote: I figured this was a simple problem, but have spent way too much time on this issue. $.saveFunc = function() { saveT(); }; function saveT () { print(save function executing) tinyMCE.activeEditor.save() print(save completed) }; buttonid=Save onclick=saveT() class=ui-state-default title=Save, only save the html, doesn't mark the claim ready for publishging.Save/button as a purejavascript/html, this works as intended, thebuttonsaves/ submits the form. save1 - SHtml.ajaxButton( Fixed, { () = { println(Jenn is on crack.); saveClaimStatus(EDITED) JsRaw($.saveFunc();).cmd; } }, (class, ui-state-default ), (title, Save and marks the claim ready for publishing.), (id, fixed)), save2 - SHtml.ajaxButton( yes, () = {println(Rhode Island Destroyed) JsRaw($.saveFunc();).cmd}) I used your example in the other thread about ajaxbutton and javascript, but I can't get the functionality I am looking for. save2 is just a testbuttonto check functionality. It does run the println, but it does not run the saveT function. 13:19:17.725 [29569...@qtp-6966554-8] DEBUG comet_trace.debug:82 - AJAXRequest: 182kyt8t8rjdz Map(F527240256671NZ2 - List(true)) Rhode Island Destroyed 13:19:17.725 [29569...@qtp-6966554-8] DEBUG comet_trace.debug:82 - AJAXResponse: 182kyt8t8rjdz InMemoryResponse( $.saveFunc();;, List((Content-Length,15), (Content-Type,text/ javascript; charset=utf-8)), List(), 200) I'm just trying to run ajavascriptfunction followed by my saveClaimStatus(EDITED) function. I just think i'm either not going about this correctly or not understanding my problem correctly. Any help would be a godsend. Thanks, Christopher --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: javascript with an ajaxbutton
I think with an import net.liftweb.http.js._ import JsCmds._ the compile problem should go away as there is an implicit defined there. But this is not important. Can you send a minimalistic code example that reflects the problem? ... including the template and Scala code. Br's, Marius On Oct 19, 9:48 pm, caw1461 caw1...@gmail.com wrote: My saveClaimSatus() function saves the passed value to the database. Firebug is not giving me any errors and prints the line to the console. The order in which the two updates happen is important because I need the status updated before the form is saved. I am using two different versions of saving to keep a temporary save and then a finalized For Publish version. so I need both of them to save the form, which i was trying to use the saveFunc to do. and removing the .cmd seems to give a syntax errors: E:\patentTracker3\prospective_claims_ver_br\patentTrackerUi\src\main \scala\com\trlr\binpr\snippet\Workflow.scala:473: error: overloaded method value ajaxButton with alternatives (String,() = net.liftweb.http.js.JsCmd,(String, String)*)scala.xml.Elem and (scala.xml.NodeSeq,() = net.liftweb.http.js.JsCmd,(String, String)*) scala.xml.Elem cannot be applied to (java.lang.String,() = net.liftweb.http.js.JE.JsRaw,(java.lang.String, java.lang.String), (java.lang.String, java.lang.String),(java.lang.String, java.lang.String)) save1 - SHtml.ajaxButton( On Oct 19, 2:20 pm, Marius marius.dan...@gmail.com wrote: I think you can simply return JsRaw($.saveFunc();) without using JsRaw($.saveFunc();).cmd Do you see any errors in the browser? ... try using firebug addon in firefox and see if it complains about anything. What does saveClaimStatus(EDITED) do? Regarding I'm just trying to run ajavascriptfunction followed by my saveClaimStatus(EDITED) function. ... when you press thebutton thatajaxfunction on the server side gets executed and it returns aJavaScriptback to browser where $.saveFunc() suppose to be executed. In your code saveClaimStatus is run before running $saveFunc() in the case of the save1buttonwhich seems to be the other way around. What is your actual use case? Br's, Marius On Oct 19, 8:29 pm, caw1461 caw1...@gmail.com wrote: I figured this was a simple problem, but have spent way too much time on this issue. $.saveFunc = function() { saveT(); }; function saveT () { print(save function executing) tinyMCE.activeEditor.save() print(save completed) }; buttonid=Save onclick=saveT() class=ui-state-default title=Save, only save the html, doesn't mark the claim ready for publishging.Save/button as a purejavascript/html, this works as intended, thebuttonsaves/ submits the form. save1 - SHtml.ajaxButton( Fixed, { () = { println(Jenn is on crack.); saveClaimStatus(EDITED) JsRaw($.saveFunc();).cmd; } }, (class, ui-state-default ), (title, Save and marks the claim ready for publishing.), (id, fixed)), save2 - SHtml.ajaxButton( yes, () = {println(Rhode Island Destroyed) JsRaw($.saveFunc();).cmd}) I used your example in the other thread about ajaxbutton and javascript, but I can't get the functionality I am looking for. save2 is just a testbuttonto check functionality. It does run the println, but it does not run the saveT function. 13:19:17.725 [29569...@qtp-6966554-8] DEBUG comet_trace.debug:82 - AJAXRequest: 182kyt8t8rjdz Map(F527240256671NZ2 - List(true)) Rhode Island Destroyed 13:19:17.725 [29569...@qtp-6966554-8] DEBUG comet_trace.debug:82 - AJAXResponse: 182kyt8t8rjdz InMemoryResponse( $.saveFunc();;, List((Content-Length,15), (Content-Type,text/ javascript; charset=utf-8)), List(), 200) I'm just trying to run ajavascriptfunction followed by my saveClaimStatus(EDITED) function. I just think i'm either not going about this correctly or not understanding my problem correctly. Any help would be a godsend. Thanks, Christopher --~--~-~--~~~---~--~~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: javascript with an ajaxbutton
edit.html: script type=text/javascript tinyMCE.init({ // General options mode : textareas, theme : advanced, plugins : spellchecker,pagebreak,save,advhr,advimage,advlink,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,noneditable,visualchars,nonbreaking,xhtmlxtras,template, theme_advanced_buttons1 : styleselect,formatselect,fontselect,fontsizeselect,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|, hr, bullist,numlist, preview, code, theme_advanced_buttons2 : , theme_advanced_buttons3 : , theme_advanced_buttons4 : , submit_patch : false, theme_advanced_resizing : true }); // The save function that actually works. $.saveFunc = function() { tinyMCE.activeEditor.save() }; function saveT () { console.log(javascript console 1) tinyMCE.activeEditor.save() console.log(javascript console 2) }; $('#fixed').click(function(e){ tinyMCE.activeEditor.save() }); /script editor:text/ br/ !-- NOW WORKS CORRECTLY -- button id=Save onclick=saveT() class=ui-state-default title=Save, only save the html, doesn't mark the claim ready for publishging.Save/button editor:save1/ editor:cancel/ editor:save2/ //*// Workflow.scala: SHtml.ajaxForm( bind(editor, xhtml, text - SHtml.textarea(originalOrEditedFileAsString (selectedClaimWorkQueue.open_!.fileName), s = { println(s) saveClaimHtmlToDB(s) saveClaimHtml(s, selectedClaimWorkQueue.open_!.fileName) S.notice(Submitted.) redirect(/workflow/claims) } , (style, height: 500px; width:97%), (id, mceForm)), save - SHtml.ajaxButton( Save, {() = Log.info(Got a 'save' AJAX call) saveClaimStatus(EDITED) S.notice(Saved.) redirect(/workflow/claims) }, (type, submit),(class, ui-state-default ), (title, Save, only save the html, does not mark the claim ready for publishging.), (id, fixed)), save1 - SHtml.ajaxButton( Fixed, { () = { println(Fixed scala/lift.); saveClaimStatus(FIXED); JsRaw($.saveFunc();).cmd); } }, (class, ui-state-default ), (title, Save and marks the claim ready for publishing.), (id, fixed)), save2 - SHtml.ajaxButton( yes, () = {JsRaw($.saveFunc();).cmd }))) } I'm already importing both of those so that isn't the problem. If I put a % (onclick - saveT()) on the button, it saves the way I want it to, but it does not do any of the println or saveClaimStatus calls. I just want it to do both. On Oct 19, 3:43 pm, Marius marius.dan...@gmail.com wrote: I think with an import net.liftweb.http.js._ import JsCmds._ the compile problem should go away as there is an implicit defined there. But this is not important. Can you send a minimalistic code example that reflects the problem? ... including the template and Scala code. Br's, Marius On Oct 19, 9:48 pm, caw1461 caw1...@gmail.com wrote: My saveClaimSatus() function saves the passed value to the database. Firebug is not giving me any errors and prints the line to the console. The order in which the two updates happen is important because I need the status updated before the form is saved. I am using two different versions of saving to keep a temporary save and then a finalized For Publish version. so I need both of them to save the form, which i was trying to use the saveFunc to do. and removing the .cmd seems to give a syntax errors: E:\patentTracker3\prospective_claims_ver_br\patentTrackerUi\src\main \scala\com\trlr\binpr\snippet\Workflow.scala:473: error: overloaded method value ajaxButton with alternatives (String,() = net.liftweb.http.js.JsCmd,(String, String)*)scala.xml.Elem and (scala.xml.NodeSeq,() = net.liftweb.http.js.JsCmd,(String, String)*) scala.xml.Elem cannot be applied to (java.lang.String,() = net.liftweb.http.js.JE.JsRaw,(java.lang.String, java.lang.String), (java.lang.String, java.lang.String),(java.lang.String, java.lang.String)) save1 - SHtml.ajaxButton( On Oct 19, 2:20 pm, Marius marius.dan...@gmail.com wrote: I think you can simply return JsRaw($.saveFunc();) without using JsRaw($.saveFunc();).cmd Do you see any errors in the browser? ... try using firebug addon in firefox and see if it complains about anything. What does saveClaimStatus(EDITED) do? Regarding I'm just trying to run ajavascriptfunction followed by my saveClaimStatus(EDITED)