Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

More problems with setFocus() 1

Status
Not open for further replies.

tviman

Programmer
Jul 25, 2002
2,123
US
With oldnewbie's help, I've managed to streamline my data forms but know it seems that in process, I've broken something else! I have a MC that is a data entry form. On this form, I have a validation routine that fires when the user presses the "SEND" button. A code snippet follows:
Code:
if (myName == "" || myName == null) {
		this.attachMovie("error_pop", "errmsg", 1);
		errmsg._x = 201.5;
		errmsg._y = -90;
		errmsg.tfMessage = "Please enter your";
		errmsg.tfMessage1 = "NAME";
		selection.setFocus("contact_box.myName");
	}
If the field is empty, another MC opens ("error_pop") telling the user that the field needs to contain data. On the "error_pop" MC there is a "BACK" button that closes the mc. So far, so good. The problem now is that the setFocus() call doesn't work. I've called it from the validation routine with no luck and I've tried putting it in the "error_pop" movie clip and still no joy. Can someone shed some lite on this for me?

Thanks to all....

Patrick

There's always a better way. The fun is trying to find it!
 
If it's from the mc, then maybe you should add...
...
selection.setFocus("_level0.contact_box.myName");
...
 
Thanks for the quik response oldnewbie. I tried that earlier and it doesn't do the job. I also tried selection.setFocus("_root.contact_box.myName"); to no avail.

Any other ideas?

There's always a better way. The fun is trying to find it!
 
Can you post a .fla, or a quick mockup replicating the problem, zipped up and in MX only format?
 
Going out for dinner... Will maybe check it later or by morning!

But tell me this... Is this an external movie loaded in another main movie (container or level?), or is the whole thing within the main movie?
 
This is a MC that is loaded onto the main stage. Bon Apetite!

There's always a better way. The fun is trying to find it!
 
Dinner was fine, thank you! Had a look... Got it to somewhat work, but I guess you would want the focus to be set according to which field was left empty and not allways to the name field... So will have to re-look at this in the morning... Had tooooooooo much wine, tonight!
 
There's no such thing as too much wine! Thanks for looking into this for me... I really appreciate it.

Patrick

There's always a better way. The fun is trying to find it!
 
Ok! Think it works, but can upload it to my free host until tomorrow afternoon... Maintenance!

Used a variable... _level0.current_empty to store any empty field...
 
oldnewbie... That's the ticket!!! exactly what I was trying to achieve. Many, many , many thanks to you for your ingenuity. I owe you, my friend!

Patrick

There's always a better way. The fun is trying to find it!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top