mycroft
07-24-2007, 09:25 AM
I have an application where I ask questions (text and/or image based) from user, and answers are MCQ based with radio button selection. After submitting the choice, next question is shown randomly.
Some questions have an image and some do not have it. When a question with image is shown, it is displayed properly. If the next question also has an image, there is no problem and image changes, but when next question has no image (the respective attribute in question tag in received xml is empty string: ""), the old image is still visible (basically the view is not updated/refreshed).
I have tried overriding different script methods of view like oninit, onload etc. but can not make it work.
Here is the code snippet:
------------------------------------
<view datapath="dset:/question/question" width="100%" >
<simplelayout axis="y" spacing="5"/>
<image datapath="@question_pic_file"/>
<text datapath="@question_text" fontstyle="bold"/>
</view>
<radiogroup name="choice">
<radiobutton datapath="dset:/question/choice">
<simplelayout axis="x"/>
<image datapath="@choice_pic_file"/>
<text datapath="@choice_text"/>
</radiobutton>
</radiogroup>
----------------------------------
while my xml is something like:
--------------------------------------
<question>
<question question_text="How about THIS" question_pic_file= "/images/27/images/153.jpg"/>
<choice choice_text="what?" choice_pic_file=""/>
<choice choice_text="some fine set of wheels" choice_pic_file=""/>
<choice ... />
</question>
--------------------------------------
Everything else updates fine enough but the image. What am I missing here?
p.s.: i forgot to mension that i have pics in choices (also optional), which work fine. I am dumbfounded really (besides being pissed) :mad:
Some questions have an image and some do not have it. When a question with image is shown, it is displayed properly. If the next question also has an image, there is no problem and image changes, but when next question has no image (the respective attribute in question tag in received xml is empty string: ""), the old image is still visible (basically the view is not updated/refreshed).
I have tried overriding different script methods of view like oninit, onload etc. but can not make it work.
Here is the code snippet:
------------------------------------
<view datapath="dset:/question/question" width="100%" >
<simplelayout axis="y" spacing="5"/>
<image datapath="@question_pic_file"/>
<text datapath="@question_text" fontstyle="bold"/>
</view>
<radiogroup name="choice">
<radiobutton datapath="dset:/question/choice">
<simplelayout axis="x"/>
<image datapath="@choice_pic_file"/>
<text datapath="@choice_text"/>
</radiobutton>
</radiogroup>
----------------------------------
while my xml is something like:
--------------------------------------
<question>
<question question_text="How about THIS" question_pic_file= "/images/27/images/153.jpg"/>
<choice choice_text="what?" choice_pic_file=""/>
<choice choice_text="some fine set of wheels" choice_pic_file=""/>
<choice ... />
</question>
--------------------------------------
Everything else updates fine enough but the image. What am I missing here?
p.s.: i forgot to mension that i have pics in choices (also optional), which work fine. I am dumbfounded really (besides being pissed) :mad: