Hi all  - anyone using states?

I have two identical states (for testing purposes). I swap them, and all of a sudden I can't access the objects in the second state.

Here's the code:
var fnameObj = canvas.searchSubviews("id","FName")
var fname = fnameObj.getText();
var lnameObj = canvas.searchSubviews("id","LName");
var lname = lnameObj.getText();
var phoneObj = canvas.searchSubviews("id","Phone");
var phone = phoneObj.getText();

Debug.write("fname obj " + fnameObj + " is " + fname);
Debug.write("lname obj " + lnameObj + " is " + lname);
Debug.write("phone obj " + phoneObj + " is " + phone);

canvas.theWin.bluePart.page2.apply();
canvas.theWin.bluePart.page1.remove();

fnameObj = canvas.searchSubviews("id","FName");
lnameObj = canvas.searchSubviews("id","LName");
phoneObj = canvas.searchSubviews("id","Phone");

Debug.write("fname obj " + fnameObj + " is " + fname);
Debug.write("lname obj " + lnameObj + " is " + lname);
Debug.write("phone obj " + phoneObj + " is " + phone);

fnameObj.setText(fname);
lnameObj.setText(lname);
phoneObj.setText(phone);



The first set of Debug.write prints out:
fname obj edittext name: FName id: FName is bret
lname obj edittext name: LName id: LName is schuhmacher
phone obj edittext name: Phone id: Phone is 4235551212

After I swap states, I get this:

fname obj null is bret
lname obj null is schuhmacher
phone obj null is 4235551212


How come I can't access the objects? I'm trying to keep the data in the field after I switch states (i.e. keep the FName populated after I switch states). Maybe there's a better way to do this...

I've tried updating the layout, but that doesn't help.

Thanks for any ideas!

Bret

Reply via email to