help with a form

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

help with a form

Brian Brown-2
Hello all!

I have the following form defined:

        html form
                defaultAction: [self saveRecord];
                name: 'reviewForm';
                with: [self checkBoxFor: obj on: html]


and checkBoxFor:on:

                html checkbox
                        submitFormNamed: 'reviewForm';
                        value: object reviewed;
                        callback: [:val | reviewValue := val].


When I click on the checkbox, the form is submitted as I expect, but  
saveRecord is never run... Anyone have any ideas?


Thanks!

Brian

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: help with a form

Boris Popov, DeepCove Labs (SNN)
If you look at the source of the page you'll notice that #defaultAction
sets up an invisible input that allows one to hit Enter key from within
the form to submit (see WAFormTag>>before), in which case your callback
will run just fine. Can you just call #saveRecord from within the
checkbox callback?

Hope this helps,

-Boris

--
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5

[hidden email]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Brian
Brown
Sent: Tuesday, October 31, 2006 10:32 AM
To: The Squeak Enterprise Aubergines Server - general discussion.
Subject: [Seaside] help with a form

Hello all!

I have the following form defined:

        html form
                defaultAction: [self saveRecord];
                name: 'reviewForm';
                with: [self checkBoxFor: obj on: html]


and checkBoxFor:on:

                html checkbox
                        submitFormNamed: 'reviewForm';
                        value: object reviewed;
                        callback: [:val | reviewValue := val].


When I click on the checkbox, the form is submitted as I expect, but  
saveRecord is never run... Anyone have any ideas?


Thanks!

Brian

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: help with a form

Brian Brown-2

On Oct 31, 2006, at 11:46 AM, Boris Popov wrote:

> If you look at the source of the page you'll notice that  
> #defaultAction
> sets up an invisible input that allows one to hit Enter key from  
> within
> the form to submit (see WAFormTag>>before), in which case your  
> callback
> will run just fine. Can you just call #saveRecord from within the
> checkbox callback?
>

Thanks, Boris! That did the trick.

Brian





_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Form and checkbox?

Carl Gundel
Is it right that a form's values can only be captured when the form's submit
button is clicked and that there can only be one submit button on a form?  I
can't have a checkbox and a button both act as a submit, but have different
callbacks, for example?

A web page can have more than one form, right?  And each can have its own
submit button?

Sorry if these are rank beginner questions, but I am really new to web
programming.

Thanks,

-Carl Gundel, author of Liberty BASIC
http://www.libertybasic.com 


_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Form and checkbox?

Philippe Marschall
2006/11/1, Carl Gundel <[hidden email]>:
> Is it right that a form's values can only be captured when the form's submit
> button is clicked and that

You could use AJAX.

> there can only be one submit button on a form?

There can be multiple submit buttons per form but only the callback of
the clicked one is evaluated.

>I  can't have a checkbox and a button both act as a submit, but have different
> callbacks, for example?

The checkbox can have a different callback than the button. If you hit
the button, first the checkbox callback will be evaluated, then the
button callback.

You could make the checkbox sumit on change (not implemented right now
but should be simple). This way the form will be submitted when the
checkbox value is changed.

> A web page can have more than one form, right?  And each can have its own
> submit button?

Yes. Note that you can not nest forms.

Philippe

> Sorry if these are rank beginner questions, but I am really new to web
> programming.
>
> Thanks,
>
> -Carl Gundel, author of Liberty BASIC
> http://www.libertybasic.com
>
>
> _______________________________________________
> Seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Form and checkbox?

Brian Brown-2

On Nov 1, 2006, at 1:21 AM, Philippe Marschall wrote:

> You could make the checkbox sumit on change (not implemented right now
> but should be simple). This way the form will be submitted when the
> checkbox value is changed.


Actually, there is a convenience method in WACheckboxTag,  
#submitFormNamed: which creates an onClick event to submit the named  
html form. Just make sure you have the WAStandardScript as part of  
your app in the configuration.

Regards,

Brian

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Form and checkbox?

Philippe Marschall
2006/11/1, Brian Brown <[hidden email]>:

>
> On Nov 1, 2006, at 1:21 AM, Philippe Marschall wrote:
>
> > You could make the checkbox sumit on change (not implemented right now
> > but should be simple). This way the form will be submitted when the
> > checkbox value is changed.
>
>
> Actually, there is a convenience method in WACheckboxTag,
> #submitFormNamed: which creates an onClick event to submit the named
> html form. Just make sure you have the WAStandardScript as part of
> your app in the configuration.

Yeah, be #beSubmitOnChange of WASelectTag is much nicer. No need to
fiddle around with form ids.
Damn do I want Traits.

Cheers
Philippe
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside