Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Setfocus() on Flash form.

Contributor ,
Jan 14, 2009 Jan 14, 2009
I have an app developed in flash forms, I am trying to make changes and add validations.
on one of the input forms I am trying to pass focus back to the input form when validation fails. This is not working see below. I have used the setfocus() and focus() for the Action script and nothing seems to be working.
TOPICS
Getting started
1.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 14, 2009 Jan 14, 2009
try Selection.setFocus("textFieldToReturnTo");
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jan 14, 2009 Jan 14, 2009
I tried that also and it hung my Browser, like its on an infinite loop.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jan 14, 2009 Jan 14, 2009
> desc.setFocus();
It works fine for me in a simple button onClick test. Maybe the field is not in scope? Shot in the dark here, but any change if you:

1. Try calling desc.setFocus(); outside your anonymous function.
2. Try using _root.desc.setFocus()

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jan 14, 2009 Jan 14, 2009
It is still hanging the browser. The prompt for the error is working only you can not click the OK button to close it, like it is opening lots of Ok buttons in an infinit loop. Below is the entire Action script. I am validating the strings entered. Its called from the onblur event of the form
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 14, 2009 Jan 14, 2009
LATEST
try moving the function from onblur to the input's in the form (eg: onKeyUp)
as this does not work (stripped down version)

<cfsavecontent variable="check2">
alert("does this work");
_root.desc.setFocus();
</cfsavecontent>

<cfform format="flash" skin="haloblue" width="300" height="200" onblur="#check2#">
<cfformgroup type="horizontal" id="myUID">
<cfinput name="UserID" width="200" maxlength="50" value="" type="text">
<cfinput name="UserID2" width="200" maxlength="50" value="" type="text" >
<cfinput name="UserID3" width="200" maxlength="50" value="" type="text" >
</cfformgroup>
</cfform>

but this does


<cfsavecontent variable="check2">
alert("does this work");
_root.desc.setFocus();
</cfsavecontent>




<cfform format="flash" skin="haloblue" width="300" height="200">
<cfformgroup type="horizontal" id="myUID">
<cfinput name="UserID" width="200" maxlength="50" value="" type="text" onkeyup="#check2#">
<cfinput name="UserID2" width="200" maxlength="50" value="" type="text" onkeyup="#check2#">
<cfinput name="UserID3" width="200" maxlength="50" value="" type="text" onkeyup="#check2#">
</cfformgroup>
</cfform>
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources