Twitter QA with JSON variables

I tried to build the twitter-QA without any java class but a json object for the tweet. In the review form I got a JavaScript error: ‘tweet’ undefined.

This was my javascript in the form:

  camForm.on('form-loaded', function() {
    // tell the form SDK to fetch the variable named 'tweet'
    console.log('form-loaded');
    camForm.variableManager.fetchVariable('tweet');
    console.log(camForm.variableManager);
  });
  camForm.on('variables-fetched', function() {
    // work with the variable (bind it to the current AngularJS $scope)
    console.log('variables-fetched');
    console.log(camForm.variableManager);
    $scope.tweet = camForm.variableManager.variableValue('tweet');
    console.log($scope.tweet);
  });

It looks exacly as the example task-embedded-form-json. With debugging I found that the variable manager has the object as it has it in the example.

After a long session of tryout and wondering someone found, that

camForm.variableManager.fetchVariable("tweet");
and
$scope.tweet = camForm.variableManager.variableValue("tweet");

makes the form to work as expected.

Could someone please explain to me, why the change from quote(’) to doublequote(") makes the variable available in the scope?

Thanks, Ingo

Hi Ingo,

that is very strange and should not happen, as single and double quote are interchangeable in Javascript. Could you find out in which line the Javascript error occurs? What browser are you using?

Cheers
Sebastian

Really strange, after switching back to single quotes and redeployment I’m unable to reproduce the error.

So there is no possiblity for further inspection. I tried it on firefox and chrome. (Both, error and sucess).

Thanks, Ingo