client side validation with jQuery

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

client side validation with jQuery

Steven Noble
I have another (hopefully quick) seaside jQuery question.  I've been
putting together a little ajax app that uses onChange a fair amount
and now I want to throw in some client side validation and I'm a
little stumped.  I realize I also need server side validation but
client side validation is nice for responsiveness.

So I have something like

        ... onChange: (html jQuery getJson
                serialize: (html jQuery this parent find: 'input');
                html: [ :h | h text: self jsonOfStrategies ];
                onComplete: 'some javascript to deal with json'

which gives me something like
         ... onchange="$.getJSON ..."
in the rendered html and I need to have a javascript if statement
wrapped around the quoted text but I'm not sure how to get it there.
Any thoughts?

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

Re: client side validation with jQuery

Lukas Renggli
> which gives me something like
>         ... onchange="$.getJSON ..."
> in the rendered html and I need to have a javascript if statement
> wrapped around the quoted text but I'm not sure how to get it there.
> Any thoughts?

Send the message #condition: to your query. This wraps the query into
a conditional statement with the argument as the condition. See the
sender JSObject>>#confirm: for an example.

Lukas

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

Re: client side validation with jQuery

Steven Noble
I'm struggling to figure out where to do this.  I think I'm mostly
having trouble because JQAjax doesn't descend from JSObject and
doesn't have a #confirm of its own.

Instead of done something like

    jsobj := (JSStream on: 'function(){return true;}()') then: (html
jQuery ajax ...

Is this there any harm in doing it this way?

Thanks again,
Steven

On Mon, Mar 30, 2009 at 10:54 PM, Lukas Renggli <[hidden email]> wrote:

>> which gives me something like
>>         ... onchange="$.getJSON ..."
>> in the rendered html and I need to have a javascript if statement
>> wrapped around the quoted text but I'm not sure how to get it there.
>> Any thoughts?
>
> Send the message #condition: to your query. This wraps the query into
> a conditional statement with the argument as the condition. See the
> sender JSObject>>#confirm: for an example.
>
> Lukas
>
> --
> Lukas Renggli
> http://www.lukas-renggli.ch
> _______________________________________________
> 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: client side validation with jQuery

Lukas Renggli
On Wed, Apr 1, 2009 at 3:04 AM, Steven Noble <[hidden email]> wrote:

> I'm struggling to figure out where to do this.  I think I'm mostly
> having trouble because JQAjax doesn't descend from JSObject and
> doesn't have a #confirm of its own.
>
> Instead of done something like
>
>    jsobj := (JSStream on: 'function(){return true;}()') then: (html
> jQuery ajax ...
>
> Is this there any harm in doing it this way?

Of course you can also do it like this, but the #confirm: thing is
certainly easier to use.

That was a bug that JQAjax didn't descend from JSObject. It does so
since a couple of days though, just load the latest version.

Lukas

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

Re: client side validation with jQuery

Steven Noble
Drat, I was so close to actually being helpful and reporting an
unknown bug; alas I'm a few days late.  Do I just load the new version
from a monticello repo somewhere?  I've been using the pre-built image
from http://builder.seaside.st/distributions/002-Seaside2.9.0-a3/Seaside2.9.0-alpha3.zip.

Thanks,
Steven

On Tue, Mar 31, 2009 at 11:41 PM, Lukas Renggli <[hidden email]> wrote:

> On Wed, Apr 1, 2009 at 3:04 AM, Steven Noble <[hidden email]> wrote:
>> I'm struggling to figure out where to do this.  I think I'm mostly
>> having trouble because JQAjax doesn't descend from JSObject and
>> doesn't have a #confirm of its own.
>>
>> Instead of done something like
>>
>>    jsobj := (JSStream on: 'function(){return true;}()') then: (html
>> jQuery ajax ...
>>
>> Is this there any harm in doing it this way?
>
> Of course you can also do it like this, but the #confirm: thing is
> certainly easier to use.
>
> That was a bug that JQAjax didn't descend from JSObject. It does so
> since a couple of days though, just load the latest version.
>
> Lukas
>
> --
> Lukas Renggli
> http://www.lukas-renggli.ch
> _______________________________________________
> 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: client side validation with jQuery

Lukas Renggli
Yeah, just load the latest Javascript-* and JQuery-* packages from
<http://www.squeaksource.com/Seaside29>. They should work independent
of the other Seaside code, that changed quite a bit since alpha3.

Lukas

On Wed, Apr 1, 2009 at 9:18 PM, Steven Noble <[hidden email]> wrote:

> Drat, I was so close to actually being helpful and reporting an
> unknown bug; alas I'm a few days late.  Do I just load the new version
> from a monticello repo somewhere?  I've been using the pre-built image
> from http://builder.seaside.st/distributions/002-Seaside2.9.0-a3/Seaside2.9.0-alpha3.zip.
>
> Thanks,
> Steven
>
> On Tue, Mar 31, 2009 at 11:41 PM, Lukas Renggli <[hidden email]> wrote:
>> On Wed, Apr 1, 2009 at 3:04 AM, Steven Noble <[hidden email]> wrote:
>>> I'm struggling to figure out where to do this.  I think I'm mostly
>>> having trouble because JQAjax doesn't descend from JSObject and
>>> doesn't have a #confirm of its own.
>>>
>>> Instead of done something like
>>>
>>>    jsobj := (JSStream on: 'function(){return true;}()') then: (html
>>> jQuery ajax ...
>>>
>>> Is this there any harm in doing it this way?
>>
>> Of course you can also do it like this, but the #confirm: thing is
>> certainly easier to use.
>>
>> That was a bug that JQAjax didn't descend from JSObject. It does so
>> since a couple of days though, just load the latest version.
>>
>> Lukas
>>
>> --
>> Lukas Renggli
>> http://www.lukas-renggli.ch
>> _______________________________________________
>> 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
>



--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside