Home Search Member List Faq Register Login  
UltimateSpell
On focus after Post back to Text Area

Thread Starter: flyer299   Started: 11-30-2007 10:43 AM   Replies: 3
 Karamasoft Support Forums » General Discussions » UltimateSpell » On focus after Post back to Text Area
 Printable Version    « Previous Thread   Next Thread »
  30 Nov 2007, 10:43 AM
flyer299 is not online. Last active: 11/30/2007 10:48:23 AM flyer299

Not Ranked
Joined on 11-30-2007
Posts 1
On focus after Post back to Text Area
I've got a function that runs that does a Post back.  After the post back is complete I have some javascript that runs that sets a [uniqueID of Control].focus() to a Text area.

After using Ultimate Spell with Spell as you type.  When this happens the cursor goes to the right place, but when you start typing the text comes up as Spaces.   Very strange.  if you move away and back to the control, then it works.

Do I need to alter my javascript.focus to something else now?

  
  30 Nov 2007, 1:40 PM
Karamasoft is not online. Last active: 5/8/2018 10:36:45 AM Karamasoft

Top 10 Posts
Joined on 09-05-2004
Posts 6,820
Re: On focus after Post back to Text Area
UltimateSpell provides a SetFocus method for the spell as you type textbox. You can call it as follows:

UltimateSpellAsYouTypes['TextBox1'].SetFocus();

You have to change TextBox1 to the client-side id of your textbox control. You also have to make sure that you call this method after UltimateSpell control fully loaded on the client-side after the page is loaded after the postback. You can use _OnLoad() client-side event handler of UltimateSpell control as follows:

function UltimateSpell1_OnLoad() {
   UltimateSpellAsYouTypes['TextBox1'].SetFocus();
}

You need to repalce UltimateSpell1 in the above code with the client-side id of your UltimateSpell control or you can use <%=UltimateSpell1.ClientID%> to get it.

Please visit UltimateSpell client-side API documentation at http://www.karamasoft.com/UltimateSpell/ClientAPI.htm to see more about the API methods.

  
  07 Jan 2008, 9:17 PM
bruceliu is not online. Last active: 4/16/2008 7:04:50 PM bruceliu

Not Ranked
Joined on 01-08-2008
Posts 3
Re: On focus after Post back to Text Area
Hi, I made the change according to your instruction, but I got another error:

"Microsoft JScript runtime error: 'UltimateSpellAsYouTypes' is null or not an object."

I also tried to attach the code to the onload event (as below). it does not work also.

Me.UltimateSpellIcon.Attributes.Add("onload", "UltimateSpellAsYouTypes['txtName'].SetFocus();")

Please help again.


  
  07 Jan 2008, 11:55 PM
Karamasoft is not online. Last active: 5/8/2018 10:36:45 AM Karamasoft

Top 10 Posts
Joined on 09-05-2004
Posts 6,820
Re: On focus after Post back to Text Area
As we pointed in our previous post, you have to make sure that you call SetFocus after UltimateSpell control fully loaded on the client-side after the page is loaded after the postback. Using _OnLoad function template of the UltimateSpell control would be one way to do it like in our previous post.

Otherwise, you can try window.setTimeout method to run SetFocus method by finding the right timeout value. For example, you can try 100 msec first, if it doesn't help, you can keep increasing it until you don't get the JavaScript error as follows:

Me.UltimateSpellIcon.Attributes.Add("onload", "window.setTimeout('UltimateSpellAsYouTypes[\'txtName\'].SetFocus();', 100);")


  
 Page 1 of 1 (4 items)
Karamasoft Support Forums » General Discussions » UltimateSpell » On focus after Post back to Text Area

You can add attachments
You can post new topics
You can reply to topics
You can delete your posts
You can edit your posts
You can create polls
You can vote in polls
Forum statistics are enabled
Forum is unmoderated

© 2002-2018 Karamasoft LLC. All rights reserved.