[Seaside] a problem with a javascript statement

Esteban Lorenzano estebanlm at gmail.com
Fri Apr 8 15:21:55 UTC 2011

Hi Johan,
Thanks for the response... I think I will go through adding #equals: protocol :)

I also prefer to put the javascript into separated files, but in this case it is a dynamic generated one, with a lot of possible statements (I was just simplifying the example... that's why I cannot use also then:else: :P)


El 08/04/2011, a las 12:03p.m., Johan Brichau escribió:

> Hi Esteban,
> This should work right out of the box:
> (JSStream on: '$(this).val().length == 0')
> 	then: (html javascript return: false)
> 	else: (html javascript return: true)
> although you might want to shrink that to: (html javascript return: (JSStream on: '$(this).val().length != 0'))
> And, indeed, there are some gaps in the javascript DSL. Although I prefer to push as much javascript out to separate files, instead of using strings or the DSL itself.
> We have nevertheless implemented some modest extensions for our own purpose, but if there is interest to seeing the DSL expanded, I would happily contribute them.
> For '==' in JS, just add this method:
> JSObject>>equals: anObject
> 	self addDecoration: (JSBinary new operator: '=='; statement: anObject)
> Also mind that the #then:else: only accepts a single javascript statement in each branch.
> I think the DSL is good to combine JS statements that you really need to generate (such as the jQuery ajax callbacks). For everything else, I use JSStream or external files.
> cheers
> Johan
> On 08 Apr 2011, at 16:39, Esteban Lorenzano wrote:
>> Hi,
>> I want to write this code: 
>> function() {
>> 	if ($(this).val().length == 0) {
>> 		return false;
>> 	}
>> 	return true;
>> }
>> but I want to use seaside javascript dsl to do that... 
>> I suppose the code should be something like this: 
>> (((html javascript return: false) 
>> 		condition: (html jQuery this find: 'input'; value; access: 'length'; equals: 0)), 
>> 	(html javascript return: true)) 
>> 	asFunction
>> the problem is: it does not exists an "#equals:" message (not a greater:, etc. )
>> so, I wonder how you do this using the DSL... is there a way? or I need to add that protocol?
>> thanks,
>> Esteban
>> _______________________________________________
>> seaside mailing list
>> seaside at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

More information about the seaside mailing list