|
Rank: Member
Groups: Registered
Joined: 9/11/2013 Posts: 21
|
Hi,
In spell checker(as you type), we are unable to set the cursor position.
For example whenever enter is pressed we want to insert some character after that character immediately we want to set the cursor position. But we are unable to do that.
Kindly do the needful as soon as possible.
|
|
Rank: Advanced Member
Groups: Administrators, Registered
Joined: 8/13/2004 Posts: 2,669 Location: Canada
|
Hi, could you show me code that works with a regular textbox without the spell checker, but doesn't work with the spell checker enabled please? Thanks Jim -your feedback is helpful to other users, thank you!-your feedback is helpful to other users, thank you!
|
|
Rank: Member
Groups: Registered
Joined: 9/11/2013 Posts: 21
|
Hi,
Let me explain it clearly.
We have designed the page with Keyoti Spell Checker. And, it works fine. One of the expected functionality is - it should be in the Bullet Mode. That is, whenever the user hits the enter button, it should go to the next line and it should automatically insert the bullet character and then, the cursor should wait immediate next to the bullet character.
Out of this, we are able to insert the new line character and we are able to insert the bullet character. But, when we inserted the bullet character from the program, the cursor does not wait immediate next to the bullet character. Instead, it waits to the next line of the bullet character.
The following is the code we have written with Keyoti for bullet insert.
else if (evt != null && evt.keyCode == 13) { var txtarea = rsw_activeTextbox.shadowTB; var scrollPos = txtarea.scrollTop; var strPos = 0; var range = document.selection.createRange(); range.moveStart ('character', -txtarea.value.length); strPos = range.text.length; var front = (txtarea.value).substring(0,strPos); var back = (txtarea.value).substring(strPos,txtarea.value.length); var text='\n'+'*'; txtarea.value=front+text+back; }
Please let us know the fix for this.
|
|
Rank: Advanced Member
Groups: Administrators, Registered
Joined: 8/13/2004 Posts: 2,669 Location: Canada
|
Thanks, sorry I didn't spot ASP.NET in your title and thought you were talking about the Win Forms spell checker. I'll move this thread to the RapidSpell Web .NET forum when I answer next. Right now I'm trying to find a solution. -your feedback is helpful to other users, thank you!-your feedback is helpful to other users, thank you!
|
|
Rank: Advanced Member
Groups: Administrators, Registered
Joined: 8/13/2004 Posts: 2,669 Location: Canada
|
Sorry for the delay, you can resolve it by shifting the caret to the correct position and calling .select (however you have to do it after the event has been processed), eg. Code: var txtarea = rsw_activeTextbox.shadowTB; var scrollPos = txtarea.scrollTop; var strPos = 0; range = document.selection.createRange(); range.moveStart ('character', -txtarea.value.length); strPos = range.text.length; var front = (txtarea.value).substring(0,strPos); var back = (txtarea.value).substring(strPos,txtarea.value.length); var text='\n*'; txtarea.value=front+text+back;
<b> rsw_activeTextbox.updateIframe();
range.move ('character',txtarea.value.length+1); setTimeout(" range.select()",50);</b>
This appeared to work properly for me, in IE9. Jim -your feedback is helpful to other users, thank you!-your feedback is helpful to other users, thank you!
|
|
Rank: Member
Groups: Registered
Joined: 9/11/2013 Posts: 21
|
Hi, Thanks for the post. We tried it. But, It inserted the "*" character, when we hit on the enter button only at the first time. And, it didnt show the cursor at anywhere at all. Afterwards, whenever, we hit on the enter button, it didnt inserted the "*" character at the right position. Please let us know the fix for this. Thanks. quote: Originally posted by Jim
Sorry for the delay, you can resolve it by shifting the caret to the correct position and calling .select (however you have to do it after the event has been processed), eg.
Code: var txtarea = rsw_activeTextbox.shadowTB; var scrollPos = txtarea.scrollTop; var strPos = 0; range = document.selection.createRange(); range.moveStart ('character', -txtarea.value.length); strPos = range.text.length; var front = (txtarea.value).substring(0,strPos); var back = (txtarea.value).substring(strPos,txtarea.value.length); var text='\n*'; txtarea.value=front+text+back;
<b> rsw_activeTextbox.updateIframe();
range.move ('character',txtarea.value.length+1); setTimeout(" range.select()",50);</b>
This appeared to work properly for me, in IE9.
Jim
-your feedback is helpful to other users, thank you!
|
|
Rank: Advanced Member
Groups: Administrators, Registered
Joined: 8/13/2004 Posts: 2,669 Location: Canada
|
Changing the bold code to this makes it work better for subsequent bullets Code: rsw_activeTextbox.updateIframe(); while(range.text.length<txtarea.value.length+1) range.moveEnd('character', 1);
range.collapse(false); setTimeout(" range.select()",50);
Unfortunately I can't see anyway around the cursor disappearing (note that although it's not visible, it is in the right place). The only suggestion for that unfortunately is to use a regular textbox and 'static' mode underlines. Best Jim -your feedback is helpful to other users, thank you!-your feedback is helpful to other users, thank you!
|
|
Rank: Member
Groups: Registered
Joined: 9/11/2013 Posts: 21
|
Hi,
It works really much better.
But, we have the following two issues that needs to be resolved.
1. It inserts the "*" character correctly, if the cursor is in the last character of the textbox. Else, if we put the cursor in between of the paragraph and if we hit enter, it inserts the "*" character correctly. But, it doesnt focus immediate next to the "*" character newly inserted. Instead, it focuses at the end of the paragraph. 2. We have two set of input fields in our screen. One is asp textbox with Rapidspell. And, others are telerik ASP .net radtextboxes. So, whenever we click on the telerik textboxes, it brings up the additional textboxes underneith. It happens only if we have asp textbox with Rapidspell in the page.
Please help us on resolving the above issues.
Thanks.
|
|
Rank: Advanced Member
Groups: Administrators, Registered
Joined: 8/13/2004 Posts: 2,669 Location: Canada
|
quote:
2. We have two set of input fields in our screen. One is asp textbox with Rapidspell. And, others are telerik ASP .net radtextboxes. So, whenever we click on the telerik textboxes, it brings up the additional textboxes underneith. It happens only if we have asp textbox with Rapidspell in the page.
That's odd, I'm sorry to ask but I'll need to see me a mockup of this that I can run. If you could make a project with everything needed (ie all the telerik scripts etc) and send to me at support@keyoti.comThanks -your feedback is helpful to other users, thank you!-your feedback is helpful to other users, thank you!
|
|
Rank: Advanced Member
Groups: Administrators, Registered
Joined: 8/13/2004 Posts: 2,669 Location: Canada
|
Further to my previous post about #2 quote:
1. It inserts the "*" character correctly, if the cursor is in the last character of the textbox. Else, if we put the cursor in between of the paragraph and if we hit enter, it inserts the "*" character correctly. But, it doesnt focus immediate next to the "*" character newly inserted. Instead, it focuses at the end of the paragraph.
In the code I posted before, this Code: rsw_activeTextbox.updateIframe(); while(range.text.length<txtarea.value.length+1)
should be Code: rsw_activeTextbox.updateIframe(); <b> range.collapse();</b> while(range.text.length<<b>(front+text).length+1</b>)
That did the trick for me. Jim -your feedback is helpful to other users, thank you!-your feedback is helpful to other users, thank you!
|
|
Rank: Member
Groups: Registered
Joined: 9/11/2013 Posts: 21
|
Hi,
rsw_activeTextbox.updateIframe(); range.collapse(); while(range.text.length<(front+text).length+1)
The above code which is given by you is working fine at some point at first time when we hit enter. But for the second time when we hit enter it will reflect like continuous ** and subsequently when we give enter again the letters are splitted separately
Issue 1:
* Testtting data Line Item 1 * Testing data Line Item two
** Testing data Line Item threr Testing dataa Linee Item 4 Testing datta Line Item five * Testing forr thee inserrtion of star in betweene * Testing data Line Item 3 Testing data Line Item 4 5 6 * Testing data Line Item to savee
Issue 2:
* Testtting data Line Item 1 * Testing data Line Item two
** Testing data Line Item threr Testing dataa Linee Item 4 Testing datta Line Item five * Testing forr thee inserrtion of star in betweene * T *esting data Line Item 3 Testing data Line Item 4 5 6 * Testing data Line Item to savee
Please look for the above issues and send us the corrections as soon as possible.
|
|
Rank: Advanced Member
Groups: Administrators, Registered
Joined: 8/13/2004 Posts: 2,669 Location: Canada
|
IE seems to be able to get the caret in a strange part of the markup, so this will fix it - it works well for me Please carefully look for changes as there are several Code: if(chr==13){ var txtarea = rsw_activeTextbox.shadowTB; var scrollPos = txtarea.scrollTop; var strPos = 0; range = document.selection.createRange(); range.moveStart ('character', -99999999); range.moveEnd ('character', 99999999);
strPos = range.text.length; var front = (range.text).substring(0,strPos); var back = (range.text).substring(strPos,range.text.length); var text='\n*'; txtarea.value=front+text+back;
rsw_activeTextbox.updateIframe(); range.collapse(); while(range.text.length<(front+text).length+1) range.moveEnd('character', 1);
range.collapse(false);
setTimeout("correctCaret(range);",50);
}
... ... function correctCaret(caret) {
if (caret.text.length == 0 && caret.moveStart("character", -1) < 0) { caret.select(); caret.moveStart("character", 1); caret.select(); caret.collapse(true); } caret.select();
}
-your feedback is helpful to other users, thank you!-your feedback is helpful to other users, thank you!
|
|
Rank: Member
Groups: Registered
Joined: 9/11/2013 Posts: 21
|
Hi, Thanks for the code. It almost meets the requirement. But, i still have the following issue. Whenever, we hit the enter button, It always inserts the * character at the end of the line in the textbox. If the user position the cursor in between any of the lines, it is supposed to insert * to the next line of the current position, instead of inserting to the end of the line. For Example: The textbox is initialized with the following text which is fetched from the DB. Now, this text has 3 sections - Assessment, Lab Order, Image Order. The user may need to insert some items under the first or second section - Assessment or Lab Order. But, it always allow the users to append the lines only at the end - which is Image Order Section here. Code: Assessment: * Test1 * Test2 * Test3
Lab Order: *Test 4 *Test 5
Image Order: *Test 7 *Test 8
Here, Lets assume that the user has to append the line "*Test 6" under Lab Order Section by hitting the enter after "*Test 5" line. Please let me know, how to fix this.
|
|
Rank: Advanced Member
Groups: Administrators, Registered
Joined: 8/13/2004 Posts: 2,669 Location: Canada
|
Ah, sorry I added range.moveEnd ('character', 99999999); when I was improving it, it obviously selects all the text, but I don't think it's necessary. Please remove it and give it a go, if it doesn't work as you need, please have a try at modifying it as needed. You had a great start at the beginning of this thread and I think I've shown how to get around the peculiarities of using iframes and selections. -your feedback is helpful to other users, thank you!-your feedback is helpful to other users, thank you!
|
|