PDA

View Full Version : Returning to main state


geneway
05-31-2007, 06:41 PM
This is a silly one but I'm looking for a fast fix.
If I submit a form and when I do I will go to another viewstate
that states the form is submitted.
I have a button on that state that with the click event i.e.
<mx:FormItem id="formitem2">
<mx:Button x="10" y="223" label="Send" click="muFuctionCall(event), currentState='submitted'" id="mySubmitButton"/>
</mx:FormItem>

I want to gpo back to the main state but I currently have the text still in the form fields. What do I do to get the foem fields cleared out so it looks like the original state.

Thanks,
Gene
:confused:

dr_zeus
05-31-2007, 06:52 PM
You have to clear the form fields manually. If you're creating a new state, you can use <mx:SetProperty/> in your declaration to target each form item and clear its text, value, or whatever.

geneway
05-31-2007, 07:50 PM
could you give me a little explanation.

Thanks,
Gene

dr_zeus
05-31-2007, 08:52 PM
This should work:

<mx:states>
<mx:State name="submitted">
<mx:SetProperty target="{textInput1}" name="text" value=""/>
<mx:SetProperty target="{textInput2}" name="text" value=""/>
</mx:State>
</mx:states>

The SetProperty overrides clear the "text" property of the TextInput controls.