[Lift] onkeypress

2010-01-18 Thread Jay Cain
Is there a SHtml.ajaxText equivalent that will perfrom an ajax call
when the onkeyPress is invoked?  I want the ability to query the db to
see if a particular username is available or unavailable each time
the user types in a letter within the input field.  I can only get
this accomplished on blur.

I tried the following:

SHtml.text(user.username, user.username = _)  % (onkeyPress -
ajaxCall(JE.JsRaw($('#username').attr('value')), s =
isUsernameAvailable(s))) }

but no bueno

Jay C.
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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] Ajax text onKeyPress

2010-01-18 Thread Jay Cain
Is there a SHtml.ajaxText equivalent that will perfrom an ajax call
when the onkeyPress is invoked?  I want the ability to query the db to
see if a particular username is available or unavailable each time
the user types in a letter within the input field.  I can only get
this accomplished on blur.

I tried the following:

SHtml.text(user.username, user.username = _)  % (onkeyPress -
ajaxCall(JE.JsRaw($('#username').attr('value')), s =
isUsernameAvailable(s))) }

but no bueno

Jay C.
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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.




Re: [Lift] Re: Ajax forms and (multiple) submit buttons

2010-01-18 Thread Adam Warski
Hello,

 Right ... and it's not even a hack ... css is the right way of
 building layout not really the html. Putting buttons in the form ar
 giving this perception in the page doesn't mean that the button has to
 be physically in the form element (at least that's the way I see
 it.).

actually I think I'll take back the doable with CSS as it's quite easy for an 
add element button, but per-element operations, like delete, move up, 
move down would take really some more time to layout properly, if they were 
placed outside the form :).

But as I said, I'll make the whole form AJAX :).

-- 
Adam-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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] Missing poms for 2.0-SNAPSHOT?

2010-01-18 Thread Jeppe Nejsum Madsen
Hi,

Just tried an mvn -U clean test and got this:

[INFO] Unable to find resource 'net.liftweb:lift:pom:2.0-SNAPSHOT' in
repository scala-tools.org.snapshots (http://scala-tools.org/repo-
snapshots)
[INFO]

[ERROR] BUILD ERROR
[INFO]

[INFO] Error building POM (may not be this project's POM).


Project ID: null:framework:pom:null

Reason: Cannot find parent: net.liftweb:lift for project:
null:framework:pom:null for project null:framework:pom:null

Did anything change recently or is this a bug?

/Jeppe
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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] how to switch to 2.0-SNAPSHOT

2010-01-18 Thread Marc
Hi,

I tried to switch a 1.1-SNAPSHOT project to 2.0-SNAPSHOT. I did this
by changing the following:

dependency
  groupIdnet.liftweb/groupId
  artifactIdlift-mapper/artifactId
  version1.1-SNAPSHOT/version
/dependency

to

dependency
  groupIdnet.liftweb/groupId
  artifactIdlift-mapper/artifactId
  version2.0-SNAPSHOT/version
/dependency

and then did

  mvn -U clean install

but I get this error:

...
[INFO] Unable to find resource 'net.liftweb:lift:pom:2.0-SNAPSHOT' in
repository scala-tools.snapshots (http://scala-tools.org/repo-
snapshots)
[INFO]

[ERROR] BUILD ERROR
[INFO]

[INFO] Error building POM (may not be this project's POM).


Project ID: null:framework:pom:null

Reason: Cannot find parent: net.liftweb:lift for project:
null:framework:pom:null for project null:framework:pom:null

Any ideas why this might not be working?

Thanks,
Marc.
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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] LiftWizard lift-examples 2.0-M1 questions

2010-01-18 Thread Tim Maxwell
Hi Folks,

I am messing around with the 2.0-M1 build and I can't figure out a
couple of things.

a. What is the prefered method of installing the lift-examples?

b. Does LiftWizard work yet? I am getting an Instantiation exception
when I call new Wizard. The docs say this exception only gets thrown
when Class.forName() tries to instantiate an interface or abstract
class. I assume this is not expected behavior, or do I just have my
classpath all screwy?

Thanks a bunch,
Tim

PS. great work on this project, lift is awesome
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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.




Re: [Lift] LiftWizard lift-examples 2.0-M1 questions

2010-01-18 Thread Indrajit Raychaudhuri


On 18/01/10 7:10 PM, Tim Maxwell wrote:

Hi Folks,

I am messing around with the 2.0-M1 build and I can't figure out a
couple of things.

a. What is the prefered method of installing the lift-examples?


Go to the corresponding directory and do mvn package.

Once done, you would have all shiny war file available in the target 
directory to deploy on your preferred container.


You can do mvn jetty:run from the project directory and get started 
even quicker.




b. Does LiftWizard work yet? I am getting an Instantiation exception
when I call new Wizard. The docs say this exception only gets thrown
when Class.forName() tries to instantiate an interface or abstract
class. I assume this is not expected behavior, or do I just have my
classpath all screwy?


Typically, you should need to bother about classpath et al. The build 
environment should take care of these things.


Suggest you start with the Wizard example in lift example 
(examples/example/src/main/scala/net/liftweb/example/snippet/Wizard.scala) 
and generally try building and running the examples to get your feet wet.




Thanks a bunch,
Tim

PS. great work on this project, lift is awesome



Cheers, Indrajit
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: LiftWizard lift-examples 2.0-M1 questions

2010-01-18 Thread Tim Maxwell

 Go to the corresponding directory and do mvn package.

I'm using the maven basic archetype. The examples directories have
been removed from that, so I don't have a corresponding directory,
this is my main obstacle.

-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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.




Re: [Lift] Re: LiftWizard lift-examples 2.0-M1 questions

2010-01-18 Thread Indrajit Raychaudhuri
I guess you meant lift-archetype-basic :) That is meant for you to 
quickly get started with a with a working project from scratch. It 
doesn't really serve as example.


For examples, go to the examples directory at the top level. They 
haven't been removed, just relocated from lift-examples to examples :)


Do a git pull to get the fresh set.

Cheers, Indrajit

On 18/01/10 8:17 PM, Tim Maxwell wrote:



Go to the corresponding directory and do mvn package.


I'm using the maven basic archetype. The examples directories have
been removed from that, so I don't have a corresponding directory,
this is my main obstacle.


-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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.




Re: [Lift] Missing poms for 2.0-SNAPSHOT?

2010-01-18 Thread Indrajit Raychaudhuri

Jeppe,

Good find! This happens because the new top level pom.xml hasn't been 
deployed in the scala-tools repo.


Have fixed in master, give it a try in half an hour or so.

Cheers, Indrajit

On 18/01/10 2:49 PM, Jeppe Nejsum Madsen wrote:

Hi,

Just tried an mvn -U clean test and got this:

[INFO] Unable to find resource 'net.liftweb:lift:pom:2.0-SNAPSHOT' in
repository scala-tools.org.snapshots (http://scala-tools.org/repo-
snapshots)
[INFO]

[ERROR] BUILD ERROR
[INFO]

[INFO] Error building POM (may not be this project's POM).


Project ID: null:framework:pom:null

Reason: Cannot find parent: net.liftweb:lift for project:
null:framework:pom:null for project null:framework:pom:null

Did anything change recently or is this a bug?

/Jeppe

-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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.




Re: [Lift] how to switch to 2.0-SNAPSHOT

2010-01-18 Thread Indrajit Raychaudhuri

Marc,

Thanks for reporting. Have fixed in master, give it a try in half an 
hour or so after hudson is done with the build.


Cheers, Indrajit

On 18/01/10 2:58 PM, Marc wrote:

Hi,

I tried to switch a 1.1-SNAPSHOT project to 2.0-SNAPSHOT. I did this
by changing the following:

 dependency
   groupIdnet.liftweb/groupId
   artifactIdlift-mapper/artifactId
   version1.1-SNAPSHOT/version
 /dependency

to

 dependency
   groupIdnet.liftweb/groupId
   artifactIdlift-mapper/artifactId
   version2.0-SNAPSHOT/version
 /dependency

and then did

   mvn -U clean install

but I get this error:

...
[INFO] Unable to find resource 'net.liftweb:lift:pom:2.0-SNAPSHOT' in
repository scala-tools.snapshots (http://scala-tools.org/repo-
snapshots)
[INFO]

[ERROR] BUILD ERROR
[INFO]

[INFO] Error building POM (may not be this project's POM).


Project ID: null:framework:pom:null

Reason: Cannot find parent: net.liftweb:lift for project:
null:framework:pom:null for project null:framework:pom:null

Any ideas why this might not be working?

Thanks,
Marc.

-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: LiftWizard lift-examples 2.0-M1 questions

2010-01-18 Thread Tim Maxwell
that worked, thanks.

On Jan 18, 8:52 am, Indrajit Raychaudhuri indraj...@gmail.com wrote:
 I guess you meant lift-archetype-basic :) That is meant for you to
 quickly get started with a with a working project from scratch. It
 doesn't really serve as example.

 For examples, go to the examples directory at the top level. They
 haven't been removed, just relocated from lift-examples to examples :)

 Do a git pull to get the fresh set.

 Cheers, Indrajit

 On 18/01/10 8:17 PM, Tim Maxwell wrote:





  Go to the corresponding directory and do mvn package.

  I'm using the maven basic archetype. The examples directories have
  been removed from that, so I don't have a corresponding directory,
  this is my main obstacle.
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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] Simple Ajax call to server side function

2010-01-18 Thread Felipe Rodrigues

Hi all,

I want to create a link which when clicked calls a server side function. 
No need for JavaScript callback.

I tried with no success:

SHtml.a(() = {serverSideFunction(t.text)}, t)


Any idea how can I accomplish that will be appreciated.


Thanks,

Felipe

--
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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.




Re: [Lift] Missing poms for 2.0-SNAPSHOT?

2010-01-18 Thread Jeppe Nejsum Madsen
On Mon, Jan 18, 2010 at 3:56 PM, Indrajit Raychaudhuri
indraj...@gmail.com wrote:
 Jeppe,

 Good find! This happens because the new top level pom.xml hasn't been
 deployed in the scala-tools repo.

 Have fixed in master, give it a try in half an hour or so.

Works now, thanks!

/Jeppe
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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.




Re: [Lift] Simple Ajax call to server side function

2010-01-18 Thread Naftoli Gugenheim
Do you want the link to navigate the browser/reload the page?

-
Felipe Rodriguesfelipero.maill...@gmail.com wrote:

Hi all,

I want to create a link which when clicked calls a server side function. 
No need for JavaScript callback.
I tried with no success:

SHtml.a(() = {serverSideFunction(t.text)}, t)


Any idea how can I accomplish that will be appreciated.


Thanks,

Felipe

-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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.


-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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.




Re: [Lift] Simple Ajax call to server side function

2010-01-18 Thread Naftoli Gugenheim
Never mind my question; I hadn't paid attention to the subject.

-
Felipe Rodriguesfelipero.maill...@gmail.com wrote:

Hi all,

I want to create a link which when clicked calls a server side function. 
No need for JavaScript callback.
I tried with no success:

SHtml.a(() = {serverSideFunction(t.text)}, t)


Any idea how can I accomplish that will be appreciated.


Thanks,

Felipe

-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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.


-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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.




Re: [Lift] Simple Ajax call to server side function

2010-01-18 Thread Felipe Rodrigues

Here is how I made it, but seems ugly:

SHtml.a(() = {serverSideFunction(t.text); Call(void, Num(0)).cmd}, t)


It is awkward having to add a JsCmd even when I don't need it.


Felipe


Naftoli Gugenheim wrote:

Never mind my question; I hadn't paid attention to the subject.

-
Felipe Rodriguesfelipero.maill...@gmail.com wrote:

Hi all,

I want to create a link which when clicked calls a server side function. 
No need for JavaScript callback.

I tried with no success:

SHtml.a(() = {serverSideFunction(t.text)}, t)


Any idea how can I accomplish that will be appreciated.


Thanks,

Felipe

  


--
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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] demo.liftweb.net down : 502 Bad Gateway

2010-01-18 Thread Jean-Luc
Hi all,

It's just to inform you that demo.liftweb.net is down. I just received a 502
Bad Gateway from http://demo.liftweb.net/
If liftweb mailing-list is not the right place to send such warning messages
: (1) sorry to bother everybody, (2) would you, please, reply with right
procedure ?

Thank you,

Jean-Luc
-- 

You received this message because you are subscribed to the Google Groups "Lift" group.

To post to this group, send email to lift...@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] Replace HTML element after AJAX call

2010-01-18 Thread ced
Hello,
I'm wondering if there is a way to replace an HTML element after an
AJAX call? I've found the SetHtml JsCmd, but this one replaces the
content. But I'd like to replace the element itself.
Any idea anyone?
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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.




Re: [Lift] Re: Replace HTML element after AJAX call

2010-01-18 Thread Alex Boisvert
Yes, using a div or span is recommended so you can replace multiple times.

Alex

On Jan 18, 2010 9:21 AM, greekscala hellectro...@gmail.com wrote:

Hello,

I looked at the source and there is JsCmds.Replace which replaces a
Node with another.
I am always using div as containers for replacement

best regards

On 18 Jan., 17:41, ced docpom...@googlemail.com wrote:  Hello,  I'm
wondering if there is a way...

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

You received this message because you are subscribed to the Google Groups "Lift" group.

To post to this group, send email to lift...@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: Simple Ajax call to server side function

2010-01-18 Thread greekscala
Hello,

know what you mean. You can use JsCmds._Noop to return nohting as
JsCmd.

best regards

On 18 Jan., 17:25, Felipe Rodrigues felipero.maill...@gmail.com
wrote:
 Here is how I made it, but seems ugly:

 SHtml.a(() = {serverSideFunction(t.text); Call(void, Num(0)).cmd}, t)

 It is awkward having to add a JsCmd even when I don't need it.

 Felipe

 Naftoli Gugenheim wrote:
  Never mind my question; I hadn't paid attention to the subject.

  -
  Felipe Rodriguesfelipero.maill...@gmail.com wrote:

  Hi all,

  I want to create a link which when clicked calls a server side function.
  No need for JavaScript callback.
  I tried with no success:

  SHtml.a(() = {serverSideFunction(t.text)}, t)

  Any idea how can I accomplish that will be appreciated.

  Thanks,

  Felipe
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: Replace HTML element after AJAX call

2010-01-18 Thread ced
Sorry, but I can't find it. Which version of Lift do you use? I'm
using version 1.0. In the scaladoc I can't find it either.


On 18 Jan., 18:21, greekscala hellectro...@gmail.com wrote:
 Hello,

 I looked at the source and there is JsCmds.Replace which replaces a
 Node with another.
 I am always using div as containers for replacement

 best regards

 On 18 Jan., 17:41, ced docpom...@googlemail.com wrote:



  Hello,
  I'm wondering if there is a way to replace an HTML element after an
  AJAX call? I've found the SetHtml JsCmd, but this one replaces the
  content. But I'd like to replace the element itself.
  Any idea anyone?
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: Replace HTML element after AJAX call

2010-01-18 Thread greekscala
Hello,

the Replace JsCmd is not present in 1.0.
workaround wrap it with an div.

best regards


On 18 Jan., 18:39, ced docpom...@googlemail.com wrote:
 Sorry, but I can't find it. Which version of Lift do you use? I'm
 using version 1.0. In the scaladoc I can't find it either.

 On 18 Jan., 18:21, greekscala hellectro...@gmail.com wrote:

  Hello,

  I looked at the source and there is JsCmds.Replace which replaces a
  Node with another.
  I am always using div as containers for replacement

  best regards

  On 18 Jan., 17:41, ced docpom...@googlemail.com wrote:

   Hello,
   I'm wondering if there is a way to replace an HTML element after an
   AJAX call? I've found the SetHtml JsCmd, but this one replaces the
   content. But I'd like to replace the element itself.
   Any idea anyone?
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: Ajax text onKeyPress

2010-01-18 Thread ced
You may try this:

def ajaxLiveText(value: String, func: String = JsCmd, attrs: (String,
String)*): Elem = {
S.fmapFunc(S.SFuncHolder(func)) {funcName =
(attrs.foldLeft(input type=text value={value}/)(_ %
_)) %
(onkeyup - makeAjaxCall(JsRaw(' + funcName +
=' + encodeURIComponent(this.value
}
}

It works like SHtml.ajaxText, but calls the server after each key
press.

Cheers,
Chris

On 18 Jan., 07:36, Jay Cain cain@gmail.com wrote:
 Is there a SHtml.ajaxText equivalent that will perfrom an ajax call
 when the onkeyPress is invoked?  I want the ability to query the db to
 see if a particular username is available or unavailable each time
 the user types in a letter within the input field.  I can only get
 this accomplished on blur.

 I tried the following:

 SHtml.text(user.username, user.username = _)  % (onkeyPress -
 ajaxCall(JE.JsRaw($('#username').attr('value')), s =
 isUsernameAvailable(s))) }

 but no bueno

 Jay C.
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: Replace HTML element after AJAX call

2010-01-18 Thread ced
Found it in the repository.
Thanks!


On 18 Jan., 18:46, greekscala hellectro...@gmail.com wrote:
 Hello,

 the Replace JsCmd is not present in 1.0.
 workaround wrap it with an div.

 best regards

 On 18 Jan., 18:39, ced docpom...@googlemail.com wrote:



  Sorry, but I can't find it. Which version of Lift do you use? I'm
  using version 1.0. In the scaladoc I can't find it either.

  On 18 Jan., 18:21, greekscala hellectro...@gmail.com wrote:

   Hello,

   I looked at the source and there is JsCmds.Replace which replaces a
   Node with another.
   I am always using div as containers for replacement

   best regards

   On 18 Jan., 17:41, ced docpom...@googlemail.com wrote:

Hello,
I'm wondering if there is a way to replace an HTML element after an
AJAX call? I've found the SetHtml JsCmd, but this one replaces the
content. But I'd like to replace the element itself.
Any idea anyone?
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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] wizard error

2010-01-18 Thread Tim Maxwell
Hi Folks,

I got the example project up and running. However as I start to modify
it, I run into a nasty error.

Here are the changes I've made:

1. added to Boot.scala

  Menu(Loc(Wiz, List(wiz), Wizard)), //boilerplate
  Menu(Loc(Wiz3, List(wiz3), Signup Wizard)), //my addition
  Menu(Loc(Wiz2, List(wiz2), Wizard Challenge)), //boilerplate

2. cp wiz.html wiz3.html

3. edit wiz3.html to point to lift:SignupWizard\ instead of
lift:MyWizard\

4. edit Wizard.scala by copy/pasting the MyWizard object and renaming
it SignupWizard

That is all I have done.

When I try to go to /wiz3.html, I get

Error processing snippetSignupWizard.Reason:Exception During Snippet
InstantiationXML causing this error:
lift:SignupWizard/lift:SignupWizard

In the jetty log its:

WARN - Snippet instantiation error
java.lang.InstantiationException:
net.liftweb.example.snippet.SignupWizard
at java.lang.Class.newInstance0(Class.java:340)
at java.lang.Class.newInstance(Class.java:308)
at net.liftweb.http.LiftSession$$anonfun$net$liftweb$http
$LiftSession$$instantiateOrRedirect$2.apply(LiftSession.scala:685)
at net.liftweb.util.ControlHelpers$class.tryo
(ControlHelpers.scala:64)
at net.liftweb.util.Helpers$.tryo(Helpers.scala:30)
at net.liftweb.http.LiftSession.net$liftweb$http$LiftSession$
$instantiateOrRedirect(LiftSession.scala:681)
at net.liftweb.http.LiftSession$$anonfun$net$liftweb$http
$LiftSession$$findSnippetInstance$1$$anonfun$apply$48.apply
(LiftSession.scala:730)
at net.liftweb.http.LiftSession$$anonfun$net$liftweb$http
$LiftSession$$findSnippetInstance$1$$anonfun$apply$48.apply
(LiftSession.scala:730)
at net.liftweb.common.Full.flatMap(Box.scala:332)
at net.liftweb.http.LiftSession$$anonfun$net$liftweb$http
$LiftSession$$findSnippetInstance$1.apply(LiftSession.scala:730)
at net.liftweb.http.LiftSession$$anonfun$net$liftweb$http
$LiftSession$$findSnippetInstance$1.apply(LiftSession.scala:730)
at net.liftweb.common.EmptyBox.or(Box.scala:374)
at net.liftweb.http.LiftSession.net$liftweb$http$LiftSession$
$findSnippetInstance(LiftSession.scala:729)
at net.liftweb.http.LiftSession$$anonfun$locateAndCacheSnippet
$1$1$$anonfun$17.apply(LiftSession.scala:820)
at net.liftweb.http.LiftSession$$anonfun$locateAndCacheSnippet
$1$1$$anonfun$17.apply(LiftSession.scala:820)
at net.liftweb.common.EmptyBox.or(Box.scala:374)
at net.liftweb.http.LiftSession$$anonfun$locateAndCacheSnippet
$1$1.apply(LiftSession.scala:820)
at net.liftweb.http.LiftSession$$anonfun$locateAndCacheSnippet
$1$1.apply(LiftSession.scala:819)
at net.liftweb.common.EmptyBox.or(Box.scala:374)
at net.liftweb.http.LiftSession.locateAndCacheSnippet$1
(LiftSession.scala:819)
at net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply$58$
$anonfun$apply$61$$anonfun$apply$63.apply(LiftSession.scala:832)
at net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply$58$
$anonfun$apply$61$$anonfun$apply$63.apply(LiftSession.scala:830)
at net.liftweb.common.EmptyBox.openOr(Box.scala:372)
at net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply$58$
$anonfun$apply$61.apply(LiftSession.scala:830)
at net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply$58$
$anonfun$apply$61.apply(LiftSession.scala:830)
at net.liftweb.common.EmptyBox.openOr(Box.scala:372)
at net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply
$58.apply(LiftSession.scala:829)
at net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply
$58.apply(LiftSession.scala:829)
at net.liftweb.http.S$.doSnippet(S.scala:1677)
at net.liftweb.http.LiftSession$$anonfun$18.apply
(LiftSession.scala:827)
at net.liftweb.http.LiftSession$$anonfun$18.apply
(LiftSession.scala:826)
at net.liftweb.common.Full.map(Box.scala:330)
at net.liftweb.http.LiftSession.net$liftweb$http$LiftSession$
$processSnippet(LiftSession.scala:826)
at net.liftweb.http.LiftSession$$anonfun
$_defaultLiftTagProcessing$1.apply(LiftSession.scala:942)
at net.liftweb.http.LiftSession$$anonfun
$_defaultLiftTagProcessing$1.apply(LiftSession.scala:930)
at net.liftweb.util.NamedPF.apply(NamedPartialFunction.scala:
33)
at net.liftweb.util.NamedPF$.apply(NamedPartialFunction.scala:
79)
at net.liftweb.http.LiftSession$$anonfun
$processSurroundAndInclude$1$$anonfun$apply$72$$anonfun$apply$73$
$anonfun$apply$74$$anonfun$apply$75.apply(LiftSession.scala:1044)
at net.liftweb.http.LiftSession$$anonfun
$processSurroundAndInclude$1$$anonfun$apply$72$$anonfun$apply$73$
$anonfun$apply$74$$anonfun$apply$75.apply(LiftSession.scala:1044)
at net.liftweb.util.ThreadGlobal.doWith(ThreadGlobal.scala:67)
at net.liftweb.http.S$.setVars(S.scala:1505)
at net.liftweb.http.LiftSession$$anonfun
$processSurroundAndInclude$1$$anonfun$apply$72$$anonfun$apply$73$

Re: [Lift] Re: Simple Ajax call to server side function

2010-01-18 Thread Felipe Rodrigues

That's a little better.. thanks

greekscala wrote:

Hello,

know what you mean. You can use JsCmds._Noop to return nohting as
JsCmd.

best regards

On 18 Jan., 17:25, Felipe Rodrigues felipero.maill...@gmail.com
wrote:
  

Here is how I made it, but seems ugly:

SHtml.a(() = {serverSideFunction(t.text); Call(void, Num(0)).cmd}, t)

It is awkward having to add a JsCmd even when I don't need it.

Felipe

Naftoli Gugenheim wrote:


Never mind my question; I hadn't paid attention to the subject.
  
-

Felipe Rodriguesfelipero.maill...@gmail.com wrote:
  
Hi all,
  
I want to create a link which when clicked calls a server side function.

No need for JavaScript callback.
I tried with no success:
  
SHtml.a(() = {serverSideFunction(t.text)}, t)
  
Any idea how can I accomplish that will be appreciated.
  
Thanks,
  
Felipe
  


--
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: wizard error

2010-01-18 Thread Tim Maxwell
I missed the step of setting up the snippet dispatcher. Fixed.

On Jan 18, 12:23 pm, Tim Maxwell truthspi...@gmail.com wrote:
 Hi Folks,

 I got the example project up and running. However as I start to modify
 it, I run into a nasty error.

 Here are the changes I've made:

 1. added to Boot.scala

   Menu(Loc(Wiz, List(wiz), Wizard)), //boilerplate
   Menu(Loc(Wiz3, List(wiz3), Signup Wizard)), //my addition
   Menu(Loc(Wiz2, List(wiz2), Wizard Challenge)), //boilerplate

 2. cp wiz.html wiz3.html

 3. edit wiz3.html to point to lift:SignupWizard\ instead of
 lift:MyWizard\

 4. edit Wizard.scala by copy/pasting the MyWizard object and renaming
 it SignupWizard

 That is all I have done.

 When I try to go to /wiz3.html, I get

 Error processing snippetSignupWizard.Reason:Exception During Snippet
 InstantiationXML causing this error:
 lift:SignupWizard/lift:SignupWizard

 In the jetty log its:

 WARN - Snippet instantiation error
 java.lang.InstantiationException:
 net.liftweb.example.snippet.SignupWizard
         at java.lang.Class.newInstance0(Class.java:340)
         at java.lang.Class.newInstance(Class.java:308)
         at net.liftweb.http.LiftSession$$anonfun$net$liftweb$http
 $LiftSession$$instantiateOrRedirect$2.apply(LiftSession.scala:685)
         at net.liftweb.util.ControlHelpers$class.tryo
 (ControlHelpers.scala:64)
         at net.liftweb.util.Helpers$.tryo(Helpers.scala:30)
         at net.liftweb.http.LiftSession.net$liftweb$http$LiftSession$
 $instantiateOrRedirect(LiftSession.scala:681)
         at net.liftweb.http.LiftSession$$anonfun$net$liftweb$http
 $LiftSession$$findSnippetInstance$1$$anonfun$apply$48.apply
 (LiftSession.scala:730)
         at net.liftweb.http.LiftSession$$anonfun$net$liftweb$http
 $LiftSession$$findSnippetInstance$1$$anonfun$apply$48.apply
 (LiftSession.scala:730)
         at net.liftweb.common.Full.flatMap(Box.scala:332)
         at net.liftweb.http.LiftSession$$anonfun$net$liftweb$http
 $LiftSession$$findSnippetInstance$1.apply(LiftSession.scala:730)
         at net.liftweb.http.LiftSession$$anonfun$net$liftweb$http
 $LiftSession$$findSnippetInstance$1.apply(LiftSession.scala:730)
         at net.liftweb.common.EmptyBox.or(Box.scala:374)
         at net.liftweb.http.LiftSession.net$liftweb$http$LiftSession$
 $findSnippetInstance(LiftSession.scala:729)
         at net.liftweb.http.LiftSession$$anonfun$locateAndCacheSnippet
 $1$1$$anonfun$17.apply(LiftSession.scala:820)
         at net.liftweb.http.LiftSession$$anonfun$locateAndCacheSnippet
 $1$1$$anonfun$17.apply(LiftSession.scala:820)
         at net.liftweb.common.EmptyBox.or(Box.scala:374)
         at net.liftweb.http.LiftSession$$anonfun$locateAndCacheSnippet
 $1$1.apply(LiftSession.scala:820)
         at net.liftweb.http.LiftSession$$anonfun$locateAndCacheSnippet
 $1$1.apply(LiftSession.scala:819)
         at net.liftweb.common.EmptyBox.or(Box.scala:374)
         at net.liftweb.http.LiftSession.locateAndCacheSnippet$1
 (LiftSession.scala:819)
         at net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply$58$
 $anonfun$apply$61$$anonfun$apply$63.apply(LiftSession.scala:832)
         at net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply$58$
 $anonfun$apply$61$$anonfun$apply$63.apply(LiftSession.scala:830)
         at net.liftweb.common.EmptyBox.openOr(Box.scala:372)
         at net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply$58$
 $anonfun$apply$61.apply(LiftSession.scala:830)
         at net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply$58$
 $anonfun$apply$61.apply(LiftSession.scala:830)
         at net.liftweb.common.EmptyBox.openOr(Box.scala:372)
         at net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply
 $58.apply(LiftSession.scala:829)
         at net.liftweb.http.LiftSession$$anonfun$18$$anonfun$apply
 $58.apply(LiftSession.scala:829)
         at net.liftweb.http.S$.doSnippet(S.scala:1677)
         at net.liftweb.http.LiftSession$$anonfun$18.apply
 (LiftSession.scala:827)
         at net.liftweb.http.LiftSession$$anonfun$18.apply
 (LiftSession.scala:826)
         at net.liftweb.common.Full.map(Box.scala:330)
         at net.liftweb.http.LiftSession.net$liftweb$http$LiftSession$
 $processSnippet(LiftSession.scala:826)
         at net.liftweb.http.LiftSession$$anonfun
 $_defaultLiftTagProcessing$1.apply(LiftSession.scala:942)
         at net.liftweb.http.LiftSession$$anonfun
 $_defaultLiftTagProcessing$1.apply(LiftSession.scala:930)
         at net.liftweb.util.NamedPF.apply(NamedPartialFunction.scala:
 33)
         at net.liftweb.util.NamedPF$.apply(NamedPartialFunction.scala:
 79)
         at net.liftweb.http.LiftSession$$anonfun
 $processSurroundAndInclude$1$$anonfun$apply$72$$anonfun$apply$73$
 $anonfun$apply$74$$anonfun$apply$75.apply(LiftSession.scala:1044)
         at net.liftweb.http.LiftSession$$anonfun
 $processSurroundAndInclude$1$$anonfun$apply$72$$anonfun$apply$73$
 $anonfun$apply$74$$anonfun$apply$75.apply(LiftSession.scala:1044)
         at 

[Lift] Re: Ajax forms and (multiple) submit buttons

2010-01-18 Thread Marius
Hi,

Something puzzled me about this as in firebug the parameters order was
correct. So here is the explanation why it doesn't for with your code:

1. HTTP parameters MAY arrive in an unpredictable order into the
servlet. Container may alter their order due to use of maps etc, or
browsers may even alter it. The point is that parameters order for
application/x-www-form-urlencoded is not specified.
2. Even if the ajax request was sent with the right order (the one
that we expected) Lift DOES the parameter sorting. This is imperative
to ensure proper execution order for form functions. Thus since the
function names that were added after you press the Add button are
lexicographically  then your submit function name (there is an
algorithm generating form function names), your submit function was
processed BEFORE those fields function.

To cope with this I modified your ajaxButton to:

  def ajaxButton(text: NodeSeq, formId: String, func: () = JsCmd,
 attrs: (String, String)*): Elem = {
val name = Z + Helpers.nextFuncName
addFunctionMap(name, contextFuncBuilder(func))

attrs.foldLeft(
button onclick={makeAjaxCall(JsRaw(
  LiftRules.jsArtifacts.serialize(formId).toJsCmd +  + 
+ Str( + name + =true).toJsCmd)).toJsCmd +
; return false;}{text}/button)(_ % _)
  }


This will ensure that your submit function will be called last. I did
some a testing with your code and having only ajaxButton changes and
the behavior was correct.


Br's,
Marius

On Jan 18, 10:36 am, Adam Warski a...@warski.org wrote:
 Hello,

  Right ... and it's not even a hack ... css is the right way of
  building layout not really the html. Putting buttons in the form ar
  giving this perception in the page doesn't mean that the button has to
  be physically in the form element (at least that's the way I see
  it.).

 actually I think I'll take back the doable with CSS as it's quite easy for 
 an add element button, but per-element operations, like delete, move 
 up, move down would take really some more time to layout properly, if they 
 were placed outside the form :).

 But as I said, I'll make the whole form AJAX :).

 --Adam
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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] Questions about Field traits

2010-01-18 Thread Tim Maxwell
I was hacking around with the 2.0-M1 release and it appears that the
StringField used by Wizard and defined in lift-base webkit
LiftScreen.scala is not the same as the StringField defined in lift-
persistence StringField.scala.

Can I assume this is an artifact of development and some unification
of types is planned? Before I go writing my own EmailField and
PasswordField, this would be good to know.

Either way, maybe a good thing to mention in the comments/docs, given
the namespace collision.

Cheers,
Tim
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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] An experience report using Scala Lift

2010-01-18 Thread Jeppe Nejsum Madsen
Hi,

A while ago, I started writing an experience report on using Scala 
Lift. I finally finished this (it has been a little more than 6 months
now, time is flying :-)

http://jeppenejsum.wordpress.com/2010/01/18/scala-and-lift-status-after-six-months/

/Jeppe
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: Help required with utility method

2010-01-18 Thread pabraham
Hi Adam,

Thanks for your advice.  Unfortunately if I paste your code, I get
error: not found: value expensesformonth.

I need to convert my m value to an instance of Month where the ID of
this instance is m, but I can't work out how.

I then tried this:

def allexpenses(expenseTemplate: NodeSeq): NodeSeq = Expense.findAll(By
(Expense.month,m.toLong)).flatmap

but the findAll() gives a List[] not a flatmap, and my Scala isn't
good enough to convert from one to the other!

Regards,

Paul.

On 18 Jan, 08:32, Adam Warski a...@warski.org wrote:
 Hello,



  I have HTML to print out expenses for a given month (i.e. URL = .../
  month/12):

  lift:MonthPage.summary
  ...
  thismonth:expenseitem
  tr
         tdmonth:item //td
         td align=rightmonth:amount //td
  /tr
  /thismonth:expenseitem
  ...
  /lift:MonthPage.summary

  The area I'm having problems with is the code to drive the above
  HTML.  I need something like:

  class MonthPage {
   def summary( xhtml : NodeSeq ) : NodeSeq = S.param(month) match {
     case Full(m) = {
       val allexpenses : NodeSeq = expensesformonth.flatmap({ month =
           bind(month, chooseTemplate(thismonth, expenseitem,
  xhtml),
               name - Text( month.item ),
               amount - Text( month.amount )
           )
         })
       bind(thismonth, xhtml, expenseitem - allexpenses)
     }
     case _ = {
       Text( Not a valid month. )
     }
   }
  }

 I think you're almost there.
 Try making the allexpenses val a function (def) NodeSeq = NodeSeq. The 
 function takes the template of the month and returns it with bound values. 
 So something like:

 class MonthPage {
  def summary( xhtml : NodeSeq ) : NodeSeq = S.param(month) match {
    case Full(m) = {
      def allexpenses(expenseTemplate: NodeSeq): NodeSeq = 
 expensesformonth.flatmap({ month =
          bind(month, expenseTemplate,
              name - Text( month.item ),
              amount - Text( month.amount )
          )
        })
      bind(thismonth, xhtml, expenseitem - allexpenses _)
    }
    case _ = {
      Text( Not a valid month. )
    }
  }

 }

 No need to lookup the right template then using chooseTemplate, as the method 
 receives the appropriate xhtml.

 --
 Adam
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: An experience report using Scala Lift

2010-01-18 Thread Timothy Perrett
Jeppe,

Very interesting stuff - agree with most of your points, however, this
statement:

While you can’t get code into your templates, it’s easy to get UI
into your code, which is (almost) just as bad. The dynamic part of the
UI is done by snippets and they of course need to emit HTML. But it is
easy to put all kinds of style, class attributes as well as other
things which belong in the template, into this dynamically generated
code. This makes it difficult for designers to modify the layout and
styling without touching the Scala code.

I think this generally goes back to developers being pretty lazy in
general; that is, the path of least resistance is the easier option
rather than being disciplined in their coding. What would you suggest
from your experience could be a solution for this? It seems the
solution would be to make it easier to do the right thing rather
than use xml literals and make bad code, but *how* could this actually
be done in a meaningful way?

Cheers, Tim


On Jan 18, 8:44 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:
 Hi,

 A while ago, I started writing an experience report on using Scala 
 Lift. I finally finished this (it has been a little more than 6 months
 now, time is flying :-)

 http://jeppenejsum.wordpress.com/2010/01/18/scala-and-lift-status-aft...

 /Jeppe
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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.




Re: [Lift] Re: Help required with utility method

2010-01-18 Thread Naftoli Gugenheim
val l = List(1,2,3)
l.map(x = x * 2)  ==  List(2,4,6)
So map take as its argument a function that transforms every member of the list.
flatmap is similar but instead of the new List *consisting of* the transformed 
elements, it consists of the *concatenation* of the results of the function 
(which must be concatenatable). So
l.flatmap(x = List(x, x * 2))  ==  List(1,2) ++ List(2,4) ++ List(3,6)  ==  
List(1,2,2,4,3,6)
Since bind returns a NodeSeq, if you would return the result of bind from a 
function you pass to *map* you would have a List of NodeSeq. Flatmap means 
you'll get the NodeSeq for each List element concatenated into one long NodeSeq.
So your code needs to continue
  ...flatmap { curExpense =
  bind(prefix, expenseTemplate, ...)
}


-
pabrahampaulabraham...@googlemail.com wrote:

Hi Adam,

Thanks for your advice.  Unfortunately if I paste your code, I get
error: not found: value expensesformonth.

I need to convert my m value to an instance of Month where the ID of
this instance is m, but I can't work out how.

I then tried this:

def allexpenses(expenseTemplate: NodeSeq): NodeSeq = Expense.findAll(By
(Expense.month,m.toLong)).flatmap

but the findAll() gives a List[] not a flatmap, and my Scala isn't
good enough to convert from one to the other!

Regards,

Paul.

On 18 Jan, 08:32, Adam Warski a...@warski.org wrote:
 Hello,



  I have HTML to print out expenses for a given month (i.e. URL = .../
  month/12):

  lift:MonthPage.summary
  ...
  thismonth:expenseitem
  tr
         tdmonth:item //td
         td align=rightmonth:amount //td
  /tr
  /thismonth:expenseitem
  ...
  /lift:MonthPage.summary

  The area I'm having problems with is the code to drive the above
  HTML.  I need something like:

  class MonthPage {
   def summary( xhtml : No