Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

How do I dynamically set a submit button target?

Avatar

Level 2

I want to programmatically set the submit button target instead of hard-coding it into the "Submit to URL" field.  This is what I tried:

1) created a separate text field, called submitToURLTxt, with data binding so that it can read the passed-in URL from an XML input file

2) created a submit button and added this code to the docReady event:

var url = submitToURLTxt.rawValue;

if (url == null || url.length == 0) {

   this.presence = "hidden";

}

else {

   this.resolveNode("#event").submit.target = url;

}

I also tried it in formcalc:

if (submitToURLTxt.isNull | submitToURLTxt == "") then

   submitButton.presence = "hidden";

else

  $.event__click.#submit.target = submitToURLTxt.rawValue;

endif

Neither way works. Help?

1 Reply

Avatar

Level 2

I'll answer my own question:

the problem is that I am running my PDF through the "Apply Usage Rights" service in Workbench, and the only usage right I had checked was "Digital Signatures."  I went back and checked the "Basic form fill-in" usage right and that fixed the submit button.  I did change my code a bit, replacing "this.resolveNode("#event").submit.target" with "this.event__click.submit.target" but I think either would work.