Expand my Community achievements bar.

SOLVED

Execute question

Avatar

Former Community Member

I have a form with an execute button, that calls a webservice to populate a field with data.

I would like to do away with the button, and call the webservice from the change event on a dropdownlist.

How can I do this?

thanks

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

The command you want is:

xfa.connectionSet.DataConnectionName.execute(boolean value)

;

Boolean value is true if you want to cause a remerge of the datadom with the template and false if you do not.

I do not recommend running the web service from the change event, I woudl recommend the exit event instead. The user can change their mind while in  the list and having multiple web service calls running coudl mess things up. The exit event will only fire when the user leaves the field and that way guarantees their selection.

Paul

View solution in original post

6 Replies

Avatar

Level 10

Hi,

You could just try copy the script from the click event in the button to the exit event of the dropdown.

Just need to check the referencing of objects to make sure that the references are complete, taking into account subforms, etc.

Should work,

Niall

Avatar

Former Community Member

There is no script on the click event in the script editor.

The button calls the webservice from the execute tab on the button object.

Although the click is defined in the xml source

<event activity="click" name="event__click">
               <execute connection="DataConnection"/>
            </event>

Avatar

Level 10

My bad

The few web service calls I have are all manually scripted in the click event. I dragged a button across and see what you mean.

One work around would be to hide the button and in the exit event of the dropdown have the following javascript firing the click event of the now hidden web service button:

myWebServiceBtn.execEvent("click"); 

Sorry,

Niall

Avatar

Correct answer by
Former Community Member

The command you want is:

xfa.connectionSet.DataConnectionName.execute(boolean value)

;

Boolean value is true if you want to cause a remerge of the datadom with the template and false if you do not.

I do not recommend running the web service from the change event, I woudl recommend the exit event instead. The user can change their mind while in  the list and having multiple web service calls running coudl mess things up. The exit event will only fire when the user leaves the field and that way guarantees their selection.

Paul

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----