A way to force a markDirty from Javascript?

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

A way to force a markDirty from Javascript?

Bernat Romagosa
Hi list,

I'm looking for a way to force a widget to mark itself dirty by using client-side Javascript.

Creating a url for [ self markDirty ] and putting it into an href attribute is not enough, for our particular needs it should be put inside an onclick attribute instead.

Is there a way to do so?

Thanks!

Bernat.

--
Bernat Romagosa.
Reply | Threaded
Open this post in threaded view
|

Re: A way to force a markDirty from Javascript?

Bernat Romagosa
Disregard my question, just found out my way around it:

| actionUrl |
actionUrl := (self context urlBuilder urlForAction: (self session registerActionFor: [ self markDirty ])) asString.
h div onClick: 'iliad.evaluateAction("' , actionUrl , '")'

So, after all, building a URL was the right way to go...

Cheers!

2012/6/6 Bernat Romagosa <[hidden email]>
Hi list,

I'm looking for a way to force a widget to mark itself dirty by using client-side Javascript.

Creating a url for [ self markDirty ] and putting it into an href attribute is not enough, for our particular needs it should be put inside an onclick attribute instead.

Is there a way to do so?

Thanks!

Bernat.

--
Bernat Romagosa.



--
Bernat Romagosa.
Reply | Threaded
Open this post in threaded view
|

Re: A way to force a markDirty from Javascript?

Nicolas Petton
In reply to this post by Bernat Romagosa
Bernat Romagosa <[hidden email]> writes:

> Hi list,
>
> I'm looking for a way to force a widget to mark itself dirty by using
> client-side Javascript.
>
> Creating a url for [ self markDirty ] and putting it into an href
> attribute is not enough, for our particular needs it should be put
> inside an onclick attribute instead.


What about this:

self onClickDo: [ self markDirty ]

It will attach the callback on the onclick event.

Cheers,
Nico

>
> Is there a way to do so?
>
> Thanks!
>
> Bernat.
>
> --
> Bernat Romagosa.
>
>

--
Nicolas Petton
http://nicolas-petton.fr
Reply | Threaded
Open this post in threaded view
|

Re: A way to force a markDirty from Javascript?

Nicolas Petton
In reply to this post by Bernat Romagosa
Bernat Romagosa <[hidden email]> writes:

Note that you can do this on any event:
#on: anEventString do: aBlock

Cheers,
Nico

> Hi list,
>
> I'm looking for a way to force a widget to mark itself dirty by using
> client-side Javascript.
>
> Creating a url for [ self markDirty ] and putting it into an href
> attribute is not enough, for our particular needs it should be put
> inside an onclick attribute instead.
>
> Is there a way to do so?
>
> Thanks!
>
> Bernat.
>
> --
> Bernat Romagosa.
>
>

--
Nicolas Petton
http://nicolas-petton.fr
Reply | Threaded
Open this post in threaded view
|

Re: A way to force a markDirty from Javascript?

Bernat Romagosa
In reply to this post by Nicolas Petton
Yup, but it had to be part of an onClick: argument, as in:

h div onClick: (something ifTrue: ['do.something()'] ifFalse: ["my problem"])

Thanks :)

2012/6/6 <[hidden email]>
Bernat Romagosa <[hidden email]> writes:

> Hi list,
>
> I'm looking for a way to force a widget to mark itself dirty by using
> client-side Javascript.
>
> Creating a url for [ self markDirty ] and putting it into an href
> attribute is not enough, for our particular needs it should be put
> inside an onclick attribute instead.


What about this:

self onClickDo: [ self markDirty ]

It will attach the callback on the onclick event.

Cheers,
Nico

>
> Is there a way to do so?
>
> Thanks!
>
> Bernat.
>
> --
> Bernat Romagosa.
>
>

--
Nicolas Petton
http://nicolas-petton.fr



--
Bernat Romagosa.