Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 394
biNNi Avatar asked Sep 10 '26 22:09

biNNi


1 Answers

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.

like image 117
Johan B Avatar answered Sep 13 '26 13:09

Johan B



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!