[Lift] Re: Binding Radio Button

2009-04-25 Thread sailormoo...@gmail.com
Oh...I think I found the reason...Thanks for the help The reason is in my code The binding to submit button is previous to binding to checkbox. if the order is changed...it would work correctly --~--~-~--~~~---~--~~ You received this message because you

[Lift] Re: Binding Radio Button

2009-04-25 Thread Derek Chen-Becker
Ah, yes. The bindings are processed in order, so the submit button has to come last or it will fire before other bindings. Derek On Sat, Apr 25, 2009 at 12:38 AM, sailormoo...@gmail.com sailormoo...@gmail.com wrote: Oh...I think I found the reason...Thanks for the help The reason is in

[Lift] Re: Binding Radio Button

2009-04-25 Thread Timothy Perrett
Glad you got it working :-) Cheers, Tim On Apr 25, 7:38 am, sailormoo...@gmail.com sailormoo...@gmail.com wrote: Oh...I think I found the reason...Thanks for the help The reason is in my code The binding to submit button is previous to binding to checkbox. if the order is

[Lift] Re: Binding Radio Button

2009-04-25 Thread marius d.
Just a small clarification if I may.The binding order do not really matter in terms of user's functions mapping. However the functions mapped are called in the HTTP parameters order sent by the browser. Br's, Marius On Apr 25, 3:53 pm, Derek Chen-Becker dchenbec...@gmail.com wrote: Ah, yes.

[Lift] Re: Binding Radio Button

2009-04-25 Thread Charles F. Munat
So if I wanted to put a submit button at the top of the form instead of (or in addition to) the bottom, how would I do that? Chas. marius d. wrote: Just a small clarification if I may.The binding order do not really matter in terms of user's functions mapping. However the functions mapped

[Lift] Re: Binding Radio Button

2009-04-25 Thread Derek Chen-Becker
If you were going to do that I would suggest a hybrid approach. Use regular HTML input tags for the submit in your form in the template and make your last bound function execute the form processing function. So the template could look like: lift:My.snippet form=POST input type=submit value=Hit

[Lift] Re: Binding Radio Button

2009-04-25 Thread Derek Chen-Becker
I just had another idea. You could add a guard field in your form using SHtml.hidden and have it set a var to true: var doForm = false bind(... guard - SHtml.hidden(() = doForm = true), submit - SHtml.submit(...)) Then the submission function *would* get called twice, but you could

[Lift] Re: Binding Radio Button

2009-04-25 Thread Derek Chen-Becker
Or a third idea. Use a hidden to execute your processing function. From the first example: lift:My.snippet form=POST input type=submit value=Hit Me! / form:name / form:desc / form:call / input type=submit value=Hit Me! / /lift:My.snippet And your snippet would look like: class My {

[Lift] Re: Binding Radio Button

2009-04-25 Thread Charles F. Munat
Clever. Derek Chen-Becker wrote: If you were going to do that I would suggest a hybrid approach. Use regular HTML input tags for the submit in your form in the template and make your last bound function execute the form processing function. So the template could look like:

[Lift] Re: Binding Radio Button

2009-04-25 Thread Charles F. Munat
My cup runneth over... Derek Chen-Becker wrote: Or a third idea. Use a hidden to execute your processing function. From the first example: lift:My.snippet form=POST input type=submit value=Hit Me! / form:name / form:desc / form:call / input type=submit value=Hit Me! /

[Lift] Re: Binding Radio Button

2009-04-24 Thread sailormoo...@gmail.com
Thanks Timothy, but can you give an example of checkbox, because no matter what I try, the binding function of checkbox doesn't seem to be called when checkbox is set. I tried some trivious binding function, but it's no effect still. --~--~-~--~~~---~--~~ You

[Lift] Re: Binding Radio Button

2009-04-24 Thread sailormoo...@gmail.com
The example from the lift book doesn't work. Listing 4.4: A checkbox example SHtml.checkbox(false, if (_) frobnicate(), Full(snazzy), class - woohoo) and mine is bind(entry, xhtml, test_mode - SHtml.checkbox(false, if (_) option_list = option_list ::: List(FlagEnum.TEST_MODE),

[Lift] Re: Binding Radio Button

2009-04-24 Thread Timothy Perrett
A checkbox should look like this: var booleanThing: Boolean = false def another(xhtml: NodeSeq): NodeSeq = { bind(c,xhtml, checkbox - SHtml.checkbox(booleanThing, booleanThing = _) % (class - myCSSclass) ) } Cheers, Tim On Apr 24, 2:16 am, sailormoo...@gmail.com

[Lift] Re: Binding Radio Button

2009-04-24 Thread Derek Chen-Becker
What doesn't work about the example? Do you get a compilation error, or it just doesn't do what you want? Derek On Thu, Apr 23, 2009 at 7:16 PM, sailormoo...@gmail.com sailormoo...@gmail.com wrote: The example from the lift book doesn't work. Listing 4.4: A checkbox example

[Lift] Re: Binding Radio Button

2009-04-24 Thread sailormoo...@gmail.com
I didn't get a compilation error, but the function in the checkbox (Boolean) = Any doesn't seem to be called bind(c,xhtml, checkbox - SHtml.checkbox(booleanThing, booleanThing = _) % (class - myCSSclass) ) As the example, booleanThing is always false no matter if I clicked the

[Lift] Re: Binding Radio Button

2009-04-23 Thread Timothy Perrett
You might find this helpful: http://is.gd/sfyT Cheers, Tim On Apr 23, 4:28 am, sailormoo...@gmail.com sailormoo...@gmail.com wrote: Hello:   And about the checkbox..  bind(entry, xhtml,       test_mode         - SHtml.checkbox(false, if (_) option_list = option_list :::

[Lift] Re: Binding Radio Button

2009-04-22 Thread Timothy Perrett
Hey, this is a classic mistake as its not well documented - radio is unlike any other bind, check out my example here: http://gist.github.com/99713 Cheers, Tim On Apr 22, 2:43 am, sailormoo...@gmail.com sailormoo...@gmail.com wrote: Hello:     var sex         = M     val sex_map =

[Lift] Re: Binding Radio Button

2009-04-22 Thread sailormoo...@gmail.com
Thanks for the help ^.^ And if I want the choices are dynamic, what should I do ? For example, there could be 3 radios, or maybe 5 radios. I still cannot understand the mechanism of lift, but may I make such binding? def example(xhtml: NodeSeq): NodeSeq = bind(entry, xhtml, radio - table{

[Lift] Re: Binding Radio Button

2009-04-22 Thread sailormoo...@gmail.com
Hello: And about the checkbox.. bind(entry, xhtml, test_mode - SHtml.checkbox(false, if (_) option_list = option_list ::: List(FlagEnum.TEST_MODE), id-test_mode)) I have a option_list of List[FlagEnum.Value] for saving the options (note : I have over 40 checkboxs), I am