SteveLacy
Posts: 6
Joined: Fri Apr 20, 2012 11:54 pm

problem setting variable value

When clicking on a button, I invoke a web service that has its output mapped to a local variable. As part of the same click event after invoking the web service, I also run some javascript to show the updated value of the local variable. The variable value doesn't update. I then tried an alternate arrangement as follows:

When clicking a button, I invoke a web service that has its output mapped to label. As part of the same event, I set the local variable value to the label text, then call some javascript to show the value of the local variable (which doesn't update, although the label clearly updates on the screen to the new value). If I click again, the local variable updates with the label value. Why won't it update initially?

It's very frustrating that I can't take the value returned from the web service and have it feed a javascript script as part of the same event.

Here's what I'm doing as part of a button click event:

  1. invoke web service (which maps output to a label on this screen)

  2. set local storage value = label text

  3. run javascript alert to show local variable value

    The label value updates, but the javascript alert showing the local storage value does not update (unless I click again).

    What am I doing wrong? Please help.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

problem setting variable value

I'm going to guess it's because the actions (service, JavaScript) are invoked asynchronously. They should be invoked synchronously so that JavaScript is run only after the service completes. Here is how to do it: http://help.tiggzi.com/documentation/...

Return to “Issues”