Marcin Okraszewski wrote:

Or you can do something like, from flow:

form.getSubmitWidget().getParent()

Which returns the RepeaterRow that was submitted. You can then do .getWidget("xxx").getValue() to get the value of a particular widget on that row.

Regards, Upayavira

Well, probably it isn't the best solution, but finally did it like this (maybe it will help some future reader):

1. In a flow I define global variable that will hold an index of pressed button, let say "index" (probably it would also work with a pseudo-field defined in model)

var index;
function myform(form) {
  ...
}

2. I define in model an on-action handler, which sets the global variable as fallows:

<wd:repeater id="myrepeater">
  <wd:widgets>
    ... <!-- fields definition -->
    <wd:submit id="row-submit"  action-command="row-submit">
      <wd:label>submit row</wd:label>
      <wd:on-action>
        <javascript>
          var row = event.sourceWidget.parent;
          index   = row.parent.indexOf(row);
        </javascript>
      </wd:on-action>
    </wd:submit>
  </wd:widgets>
</wd:repeater>

3. If submit is pressed, first the form is validated, than the "on-action" is preformed and finally a flow script continues execution. Now I can simply get index, just like that:

  if (form.submitId == "row-submit")
    print("submit at row: ", index);

As simple as that :-) I know, it isn't very "elegant", but it works. Maybe someone has better solution?

Regards,
Marcin Okraszewski



Hi,
Is it possible to obtain which submit widget was pressed in a repeater? If I use form.submitId, I obtain only id of widget, but I don't know from which row the submit comes from.


Regards,
Marcin Okraszewski


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]





--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to