biNNi
biNNi

Reputation: 43

Open a link in seaside using javascript

Hi I am a newbie in Seaside and Smalltalk. I am developing a search application where the user posts a query and the system displays relevant results. Now to implement feedback, I want to know when a user has clicked a particular link. Thus clicking on a link involves 2 things: 1) Navigating to that particular link 2) Registering in the background that the user has clicked that link. I am stuck at doing this. It would be great if someone could help out with this. I got some idea about how to go about doing this reading other posts where I was suggested to implement a callback and use javascript in that callback to open the link. Can some one provide the code for doing that.

Thank you.

Upvotes: 3

Views: 207

Answers (1)

Johan B
Johan B

Reputation: 2471

The answer depends on what kind of link you have. Is it a link to an (external) webpage or is it a link within the Seaside application itself? In case of the former, it would make sense to combine a Seaside callback for the click registration and javascript to navigate to the link. You can find an example for that in this question: seaside : 2 events on html anchor.

In the other case, the callback that executes when you click a link in a Seaside application can do both the registration of the user action and navigate the user to the other page in your application:

html anchor
   callback:[ self registerClick. self call:: newPageComponent];
   with: 'click this'

Check out the Seaside book to know all about callbacks and component navigation.

Upvotes: 1

Related Questions