[Seaside] Re: String concatenation in javascript

Winfried Jacobs news at winfried-jacobs.de
Tue Jun 4 15:58:20 UTC 2013


Hello Dave,

with a little extra method in JSObject (*) you could even write it completely in
Smalltalk:

   html anchor
       onClick: (
           (html jQuery id: 'textAreaId') value: (
               html jQuery id: 'textAreaId') value + 'some text'
               );
       with: 'a label'.


(*) Method #+ in JSObject defined like this:

+ anObject
    "Combine the receiver and anObject with a plus sign"

    self addDecoration: (JSBinary new operator: '+'; statement: anObject)


Best regards
Winfried



> Dav <lasmiste at gmail.com> hat am 4. Juni 2013 um 17:23 geschrieben:
>
>
> Johan Brichau-2 wrote
> > The JSObject>>, is for concatenating generated javascript expressions. If
> > you want to generate a javascript expression that does string
> > concatenation, you need to write actual javascript.
> > Afaik, there is no Seaside method to generate string concatenation
> > expressions.
>
> I guess you are right
>
>
> > I'm not seeing the stuff you might have pasted in your email correctly,
>
> The expressions was:
>
> Unfortunately it generates this html:
> a label
>
> Instead I need an html like:
> a label
>
>
> > but this is how I would write your expression:
> >
> > html anchor
> > onClick: ((html jQuery id: 'textAreaId') value: (JSStream on:
> > '$(''#textAreaId'').value()+''some text'' '));
> > with: 'a label'.
> >
> >
> > cheers,
> > Johan
>
> Thanks Johan it works, even if there is a typo: value() instead of val()
>
> The right one is:
> html anchor
> onClick: ((html jQuery id: 'textAreaId') value: (JSStream on:
> '$(''#textAreaId'').val()+''some text'' '));
> with: 'a label'.
>
> Cheers,
> Dave
>
>
>
> --
> View this message in context:
> http://forum.world.st/String-concatenation-in-javascript-tp4691470p4691616.html
> Sent from the Seaside General mailing list archive at Nabble.com.
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


More information about the seaside mailing list