Home Search Member List Faq Register Login  
UltimateSpell
Drag and drop html elements into SpellAsYouType textbox.

Thread Starter: djcowan   Started: 04-09-2008 11:42 PM   Replies: 3
 Karamasoft Support Forums » General Discussions » UltimateSpell » Drag and drop html elements into SpellAsYouType textbox.
 Printable Version    « Previous Thread   Next Thread »
  09 Apr 2008, 11:42 PM
djcowan is not online. Last active: 3/22/2009 3:15:46 PM djcowan

Top 10 Posts
Joined on 02-12-2008
New Zealand
Posts 9
Drag and drop html elements into SpellAsYouType textbox.
If a user selects html items on the screen, they are able to drop them into the spellAsYouType textbox.

This can be shown on your Spell As You Type sample page.  Drag the SpellWaitPeriod dropdown into the spell textbox.

Is there anything that can be done  to prevent this?

  
  11 Apr 2008, 1:54 PM
Karamasoft is not online. Last active: 9/2/2010 12:02:18 PM Karamasoft

Top 10 Posts
Joined on 09-05-2004
Posts 5,325
Re: Drag and drop html elements into SpellAsYouType textbox.
Yes, you can prevent drag-and-drop using the UltimateSpell client-side API functionality. You should define ondrop event handler and cancel the event when it fires as follows:

<script type="text/javascript">
function <%=UltimateSpell1.ClientID%>_OnLoad() {
   UltimateSpellAsYouTypes[
'TextBox1'].AddEventHandler('drop', function(evnt) { HandleDrop(evnt); });
}

function
HandleDrop(evnt) {
   UltimateSpellAsYouTypes[
'TextBox1'].CancelEvent(evnt);
}
</script>

You need to replace UltimateSpell1 with the server-side ID of your UltimateSpell control and replace TextBox1 with the client-side ID of your text area control.

Please also note that we made some minor changes in our JavaSCript code, which we will email you shortly.


  
  15 Apr 2008, 11:40 AM
gotProblems is not online. Last active: 6/27/2008 2:30:16 PM gotProblems



Top 10 Posts
Joined on 12-10-2007
Virginia
Posts 26
Re: Drag and drop html elements into SpellAsYouType textbox.
I too am trying to prevent users from being able to drag controls, images, selected items and drop them into the SAYT field.  I tried the example you gave using the code below:

function UltimateSpell1_OnLoad()

   alert(1);
   UltimateSpellAsYouTypes['txtSpellCheckField'].AddEventHandler('drop',function (evnt) {HandleDrop(evnt)});
   alert(2);
}
function HandleDrop(evnt) 
{
   alert('txtSpellCheckField');
   UltimateSpellAsYouType['txtSpellCheckField'].CancelEvent(evnt);
}

with no avail.  The following is the html for my textbox that the spellcheck is on.

<input name="txtSpellCheckField" type="text" maxlength="255" id="txtSpellCheckField" />

This is the "View Source" of the control from IE (not from Visual Studio).  I just colored it to make it easier to read.

My server control is done this way:
<asp:TextBox AutoPostBack=False MaxLength=255 ID=txtSpellCheckField Runat=server></asp:TextBox>

I see the alerts "1" and "2" just fine.  But if I drag something into the SAYT field it drops just fine.  I never get the alert of "txtSpellCheckField".  Can someone identify what I am doing wrong?

  
  15 Apr 2008, 12:09 PM
Karamasoft is not online. Last active: 9/2/2010 12:02:18 PM Karamasoft

Top 10 Posts
Joined on 09-05-2004
Posts 5,325
Re: Drag and drop html elements into SpellAsYouType textbox.
It is because we haven't published the latest JavaScript files on our website yet. We will send you a patch shortly.
  
 Page 1 of 1 (4 items)
Karamasoft Support Forums » General Discussions » UltimateSpell » Drag and drop html elements into SpellAsYouType textbox.

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-2010 Karamasoft LLC. All rights reserved.