0

i want to validate my json response from web service,before doing transition to page 2.if json String response have error code it should not go to page 2.

<view-state id="page1" view="page1.html">
  <transition on="save" to="page2">
     <set name="flowScope.webserviceRes" value="webserviceClass.getwebServiceRes('testdata')" />
  </transition>
</view-state>

<view-state id="page2" view="page2.html">

</view-state>
rish1690
  • 281
  • 1
  • 3
  • 13
  • Where is your web service call being made? Explain clearly. – Prasad Jul 10 '14 at 11:34
  • at Set statement on save – rish1690 Jul 10 '14 at 13:14
  • And you expect the value in Set to call the webservice with single quotes around it? – Prasad Jul 10 '14 at 14:11
  • yes my bad their should not be single quote,but my question was different. – rish1690 Jul 10 '14 at 14:23
  • Yes I am trying to understand. Here are the questions before some one answers your question: 1) Do you have validator configured for the views in this flow? 2) I doubt if you can call webservice by set, you need to use evaluate-action. Did you check if call is being made to webservice? 3) If there is a validator, can you not call this service there to check it? – Prasad Jul 10 '14 at 15:38
  • hi prasad , we are able to call method from set which calls webservice ,and yes we are not using any validator as their are no model ,we are using json through out in application as we only communicate with web service which return us json. issue is that when some one click save i need to go to page 2 with saving page 1 data, and saving gives json back with error codes 00=success, if not success then too ill be moving page 2. – rish1690 Jul 11 '14 at 07:51
  • only solution i think of is validate json in action, if it fails then reload page 1 with same data re render which user have typed before saving. – rish1690 Jul 11 '14 at 07:53
  • I think action state is ideal for you now. – Prasad Jul 13 '14 at 02:19

0 Answers0