Can't execute button click from javascript

DarrellDoesData

01-03-2015

I'm trying to execute an Add button click-event from a folder-level javascript function. The button triggers an AddInstance on a repeatable subform. I've tried every combination of syntax I can figure out and I get an error every time.

The button resides on the footer of the subform below...

AddButton on Form.png

The Form uses data binding, and the form names are different from the data names, is as follows...

IDS_Hierarchy_to_DataView.png

The addbtn click event is scripted as follows:

PatItems_AddBtn_Click_Event.png

I've tried each of these commands from the console...

  1. us_ids.sffoot.addbtn.execEvent("click"); -- "us_ids is not defined"
  2. xfa.us_ids.sffoot.addbtn.execEvent("click"); -- "xfa.us_ids has no properties"
  3. xfa.form.us_ids.sffoot.addbtn.execEvent("click"); -- "xfa.form.us_ids has no properties"
  4. xfa.resolvenode("us-ids.sffoot.addbtn").execEvent("click"); -- "xfa.resolvenode is not a function"

I would welcome some guidance on how to structure the command(s) to either trigger the button click or execute the AddInstance.

Thank you.

Accepted Solutions (0)

Answers (2)

Answers (2)

radzmar

MVP

02-03-2015

Well,

let's start very simple.
What happens when you only use the following script in the Add button?


_sfpatitemflow.addInstance(1);


If nothing happens you should check the JavaScript console (Ctrl + J) for any errors.