Event Data

I have an event being passed into a method that returns the following when outputted:

JSEvent(type = form, source = FormController[form: frm_global_register_filter_columns, fs size:18, selected record: Record[DATA:Row(db:/pt_system/tbl_list_filter)[DATA:list_filter_id=1899,list_id=153,filter_column=hsea_no_string,filter_alt_label=Text in Rec. No.,filter_control_id=1,filter_order=1,use_rowsource=null,rowsource=null,custom_rowsource_method=null,custom_rowsource_scope=null,related_rowsource_column=null, CALCULATIONS: {}]] COLUMS: list_filter_id,list_id,filter_column,filter_alt_label,filter_control_id,filter_order,use_rowsource,rowsource,custom_rowsource_method,custom_rowsource_scope,related_rowsource_column,rollbackChanges,getDataSource,revertChanges,getPKs,save,deleteRecord,isNew,getChangedData,getFoundset,hasChangedData,getException,isEditing,,destroyed], formName = frm_global_register_filter_columns, elementName = <no name>, timestamp = Tue Sep 24 14:59:21 CDT 2013,modifiers = 0,x =0,y = 0,data = null)

I need the “list_id” value from the DATA but cannot for the life of me figure out how to extract it from the event. Any ideas?

Thanks,

Keith

Hi CFDaddy,

This should do the job:

forms[event.getFormName()].list_id

PERFECT!!! Thank you.

mboegem:
Hi CFDaddy,

This should do the job:

forms[event.getFormName()].list_id

As an addendum to this post, I need to find a way to get the x,y value for a button/lable in a table view list. My first thought was to use ‘event’ so when I output event I get this:

JSEvent(type = action, source = BUTTON[name:File_Description,x:0,y:40,width:391,height:20,value: interface image], formName = referenceFileList_77229, elementName = File_Description, timestamp = Tue Oct 08 09:30:03 CDT 2013,modifiers = 0,x =136,y = 11,data = null)

The x,y of the button is 0,40. I’ve tried a few different ways to get the data but have not been successful. For example:

application.output(event)
application.output('ele x: '+forms[event.getFormName()].elements[event.getElementName()].getLocationX())
application.output('ele y: '+forms[event.getFormName()].elements[event.getElementName()].getLocationY())
application.output('evt x: '+forms[event.getFormName()].x)
application.output('evt y: '+forms[event.getFormName()].y)

The results of that code is:

JSEvent(type = action, source = BUTTON[name:File_Description,x:0,y:40,width:391,height:20,value: interface image], formName = referenceFileList_77229, elementName = File_Description, timestamp = Tue Oct 08 10:11:59 CDT 2013,modifiers = 0,x =270,y = 9,data = null)
ele x: 0
ele y: 0
evt x: undefined
evt y: undefined

So, my question is, how can I obtain the BUTTON information from the JSEvent?

Thanks in advance!

I figured this out so I thought I’d post the answer in case anyone else comes looking. Using event.getSource() will reveal the data as follows:

application.output('src x: '+event.getSource().getLocationX());
application.output('src y: '+event.getSource().getLocationY());

Hi Keith,

Also getSource() can return any object, so to keep your warning markers down (and have some code completion) you should cast the result to the object you’re getting. In your case the JSButton object.

Hope this helps.