[Lift] Re: javascript with an ajaxbutton

2009-10-22 Thread caw1461

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  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  wrote:
>
> > edit.html:
>
> >     
>
> >     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()
> >     });
> >     
>
> >     
> >     
>
> >     
> >      > title="Save, only save the html, doesn't mark the claim ready for
> > publishging.">Save
>
> >     
> >     
> >     
>
> > //*//
>
> > 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",
> >               { 

[Lift] New update changed something?

2009-10-22 Thread caw1461

So I was running everything for my program fine last night.  Got on
this morning, updated scala when compiling and I am getting a lot of:

error: not found: value Box
error: value map is not a member
error: value openOr is not a member of Nothing
etc.

Was there a big update changing a bunch of these things, or did I
change some code to break all of this? I'm pretty sure I haven't made
any significant changes.

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

2009-10-19 Thread caw1461

edit.html:






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()
});






Save





//*//

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  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  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 
> > (scala.xml.NodeSeq,() => net.liftweb.http.js.JsCmd,(String, String)*)
> > scala.xml.Elem cannot be applied to (java.lang.String,() =>
&

[Lift] Re: javascript with an ajaxbutton

2009-10-19 Thread caw1461

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 
(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  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  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")
> >     };
>
> >      > title="Save, only save the html, doesn't mark the claim ready for
> > publishging.">Save
>
> > 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] javascript with an ajaxbutton

2009-10-19 Thread caw1461

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")
};


Save

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] Tabs + menu builder

2009-09-17 Thread caw1461

I'm working on a UI for a project and we are looking at the jquery
tabs.  Currently we just have a plain menu builder site map.  we are
thinking that a good way to create our UI is to somehow link the site
builder with the Tabs such that each tab holds a different link from
the site map.  I know this is slightly vague, but any advice for a new
to lift and scala and HTML/XML.

Thanks in advance

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