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