Referencing the Control that has been clicked (Serverside)

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

AJDulk
Ebase User
Posts: 94
Joined: Fri Sep 14, 2007 12:18 pm
Location: The Netherlands
Contact:

Referencing the Control that has been clicked (Serverside)

#1

Postby AJDulk » Thu Jul 07, 2016 2:39 pm

In HTML when an item is clicked the JavaScript connected to the item can reference the item with the keyword "this". This way the script can change properties of an item with this.propertyName = ...

I am looking to use a single server side script (written in JavaScript) in a similar manner. I have 4 hyperlink controls, when a control is clicked I need to change the colour of that control (toggle between 2 colours).

The question is how do I reference the clicked control in the server-side script?
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#2

Postby Jon » Thu Jul 07, 2016 2:49 pm

You use event.owner which returns the object where the event is configured - this will be a Control, Page or the Form itself. If it's a control you can then invoke any supported method e.g. for a Button Control:

Code: Select all

event.owner.setBackgroundColor("red");
0 x

AJDulk
Ebase User
Posts: 94
Joined: Fri Sep 14, 2007 12:18 pm
Location: The Netherlands
Contact:

#3

Postby AJDulk » Thu Jul 07, 2016 2:58 pm

Thanks, I knew there was a way but could not find it easily.
0 x


Who is online

Users browsing this forum: No registered users and 27 guests