Page 1 of 1

onClick / row property on subfile field

Posted: Thu Nov 10, 2011 8:08 am
by hbi
Need some help with the ROW property on a subfile field.

From other topics in this forum I can see that there is a ROW property (or variable) giving the actual row for a subfile field.

I am trying to create an onClick script for a subfile field resulting in change of an option field in the same row and then generate an Enter (submit). The Enter works fine, but the reference to the row doesn't work. Sure I am doing something wrong.

The script is the OnClick is:
changeElementValue("S1X.row","2");pui.click("btnSubmit");
This should change the S1X (an option field) on the same row as the clicked field to '2', but it doesn't do it. If I change the row to a fixed number it works.

Ideas about what I am doing wrong ?

Brgds
Helge

Re: onClick / row property on subfile field

Posted: Thu Nov 10, 2011 10:45 am
by Brian
Try:

changeElementValue("S1X." + row,"2");pui.click("btnSubmit");

Re: onClick / row property on subfile field

Posted: Thu Nov 10, 2011 1:09 pm
by hbi
Doesn't work.
I get
OnClik Error: 'row' not defined.

Re: onClick / row property on subfile field

Posted: Thu Nov 10, 2011 6:36 pm
by Brian
Ok, so you are on the onclick event of an individual field in the grid. Now I understand your dilemma.

Try this:

var id = this.id; row=id.split(".")[1];changeElementValue("S1X." + row,"2");pui.click("btnSubmit");

This should retrieve the current elements id, which will include the row number. The split function will split the id at the period and return the second half ([1]) which is the row number. Then the code I gave you previously should work. I did not get a chance to test this, but it should work.

Re: onClick / row property on subfile field

Posted: Thu Nov 10, 2011 8:18 pm
by hbi
Dear Brian.

That works ! Thank you very much.

Brds
Helge