I'm not sure if this is a scala or a lift related question, but when I
try to bind a submit button, I'm having some confusion on using zero
parameter functions as the "() -> Any" parameter in the submit
signature.
The signature for the method in question is
SHtml.submit(value : String, func : () => Any, attrs : (String, String)
*)
1. My first question is about the following method definitions
def processForm () : Unit = {...}
vs
def processForm = {...} //no parentheses after method declaration
Why can I call "processForm" as well as "processForm()" for the first
example, but only "processForm" for the second example. If there is
scala/lift documentation on this simple question?
2. Why do I get a compiler error when I use the following code:
bind( ...
"submit" -> SHtml.submit( "Process Form", processForm() ) /*type
mismatch error*/
)
vs
bind( ...
"submit" -> SHtml.submit( "Process Form", processForm ) /*compiles
successfully*/
)
It's my impression that the above bind calls are equivalent given the
way the scala compiler behaves when I call "processForm" or
"processForm()".
Also, I wasn't even sure the method itself would allow the code to
compile. I thought I'd have to do "() -> processForm" or "() ->
processForm()".
The error I was getting was this:
error type mismatch
found : Unit
required : () -> Any
Can someone please clarify? Thanks so much.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---