setValue is not work? Why it happen?

  • Hi Michael Hall, I'm using JCaiF 0.6 (because I can not build on version 0.7) the setValue method is not work?

    I want catch the user inputted value in the input field, so I can't! Here is some code in XML file, can you correct it for me?!

    <SurveyQuestion id="respnum" class="org.JCaiF.CoreComponents.NumberInputQuestion" pattern="\d+" min="1" max="100">
                <text>This is the old respnum text</text>
                <onLoad lang="java"><![CDATA[
                    respnum.setText("This is the new respnum text");
                    respnum.setText(respnum.getText() + ": ");
                    respnum.setText("Enter again, last value: (" + respnum.getValue() + ") is not valid!");

    • Michael hall
      Michael hall

      I'm not sure what you are trying to do, but the last line in onContinue "respnum.setValue(respnum.getValue())" isn't necessary.  Remember though, that onLoad is run every time a question is displayed, so even though you set the text in the onContinue block, it will be reset by onLoad before the question gets displayed again.  Are you using Sonar App or Sonar Web?