tablejoin and this.id

remroc

New Member
Hello,

1st thank you fabrik team for this great component ! O0

I am using fabrik 3.0.6.3-565 updated from git.

I have created a tablejoin (left join) from table A to table B.

Table A
id
datetime
name (field)

Table B
id
datetime
price (field)
quantity (field)


I want to access price and quantity element ID through javascript in order to calculate price * quantity for each repeated group.

On the event blur of price and quantity, I put directly the following javascript (there is no X.js in components/com_fabrik/js/):

Code:
var ID = this.element.id;
alert(ID);
Whatever the repeated group number, it gives : join___43___tableb___price_0 and join___43___tableb___quantity_0.

Here is the form

How should I get the proper ID ? (ie for repeat group number 2, I should get :
join___43___tableb___price_2 and join___43___tableb___quantity_2)

Thank you for your help.

remroc

PS : From fabrik wiki, I tried this.id but it gives me : undefined. This is why I use this.element.id
 
In order for me to debug this one, you'll need to put that code in a function in an X.js file, and call the function from the element JS action, so I can put a break point inside the function and see what's going on.

You may need to pass 'this' in as an arg to the function.

-- hugh
 
Hi Hugh,

The code is in the file 36.js. You can access the form through : form url

Code:
function sum(el){

var ID = el.element.id;
alert(ID);

}
Thanks for your help.

Cheers

Remroc
 
OK, I've replicated this on my test server, trying to work out why the event is being fired from the "wrong" element.

-- hugh
 
Hello team Fabrik and community,

I wish you a happy new year !!

Thank you Hugh for your help :)

remroc
 
Thank Rob. Although i have a sneaky suspicion that the way he fixed it may lead to some other issues ... something is nagging at me about why we implemented it the way we did in the first place, to do with the way we apply and store element events, and clone them when duplicating a group.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top