Expand my Community achievements bar.

SOLVED

getting current event (name) of a field - possible / how to ?

Avatar

Level 3

Hello,

I wonder if it is possible to get the event name of a field like:

(form.pag1.mytextfield::enter - JavaScript, client)

var eventname = this.MagicJSfunction();

It is sure possible to get the current Event-Name with:

(form.pag1.mytextfield::enter - JavaScript, client)

var eventname = event.name; 

It is a pity it is always  = "Focus" where ever I use it  (form.pag1.mytextfield::ENTER - JavaScript, client)  (form.pag1.mytextfield::EXIT - JavaScript, client)

(form.pag1.mytextfield::enter - JavaScript, client)

my_scripting_obj.my_set_design_function(this, eventname);

Reason:

I use to change the design of a field in realtion to its event in my scripting object. By calling the function of my scripting object I would love to use some copy & paste.

I have over 120 field where that function should be called on enter and exit event.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

Does this help? http://assure.ly/h8ZLr5.

In this case, I call the function from the enter and exit events of each field.

Niall

View solution in original post

3 Replies

Avatar

Correct answer by
Level 10

Hi,

Does this help? http://assure.ly/h8ZLr5.

In this case, I call the function from the enter and exit events of each field.

Niall

Avatar

Level 3

Hi,

actually it does not answer the question ; )

But thank you anyway for the nice example. I now use your suggestion!

BEWARE: the whole issue is not important. I just would like to know if my idea would work. ; )

You use two functions to control the field appireance. Well I would like to be much lazier in this case.

I try to use one function which could be just copy&pasted everywhere. It actually works but there is still some work to do -> changing the event name

Field ABC: enter - event:

changeDesign(this, "enter");

Field ABC: exit - event:

changeDesign(this, "exit");     // <--- replace exit with "this.GiveMeTheEventNameButNot

function changeDesign (fieldObj, eventName){

     switch (eventName){

          case "exit":

               ....

          case "enter"

               ....

          case "whateverEventElse"

               .....

     }

}

Avatar

Level 10

Hi,

You can get the event using FormCalc, but I am failing to get a JavaScript equivalent working:

$.#event.activity

Brain going soft ;-)

Niall