Print Page | Close Window

RTE made me lose focus on a field

Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz Rich Text Editor (RTE)
Forum Description: Support forum for the Web Wiz Rich Text Editor (RTE).
URL: https://forums.webwiz.net/forum_posts.asp?TID=23284
Printed Date: 29 March 2026 at 7:08am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: RTE made me lose focus on a field
Posted By: julia444
Subject: RTE made me lose focus on a field
Date Posted: 09 May 2007 at 7:32pm
I have a web page which used to work fine until i added a rich text editor.

the pages are in ASP and it is a news weblog, with a comments section where people click the headline of a comment and it opens into a pop up page ccalled "comment_view.asp" which has a reply button. If anyone wants to reply to the message, they click reply and it takes them to the parent page (view.asp) where there is a form for them to fill in,and submit the comment. It was setup to prefill the "subject" and focus on the "comment" section.

This used to work fine until i added a "rich text editor" to the comment box. What happens now, is that the subject DOES get prefilled, however, the cursor does not focus on the "comment". I did change some of the things in the comment submission form, however i can't see what the problem is. I need the cursor to focus on "comment" like it used to and send the comment into the taskbar, like before. Does anyone know what i need to add or change?
 
<td width="20%" height="38" align="left" valign="middle"><%IF blLOGGED_IN = True THEN%>
            <a href="javascript:Respond();" class="keyplayersmall style6">Post Reply</a>
            <%END IF%>
        &nbsp;</td>
       
    </table>
<script langauge="javascript">
function Respond(){
opener.document.frm3.subject.value="RE:<%=SUBJECT%>"
opener.document.frm3.comment.focus();

}
              </script>

Here is the code from the page where the comment form is

<body OnLoad="initialiseWebWizRTE();"> <table align="center" width="400" cellpadding="2" cellspacing="0" border="0"> <form action="_comments.asp?ID=<%=NID%>" method="post" name="frm3" id="frm3" onSubmit="return ValidateComment()"> <tr> <td width="100">Name</td> <td width="300"><%=Session("PMMS_USERNAME")%></td> </tr><tr> <td>Country</td> <td width="300"><%=Session("PMMS_COUNTRY")%></td> </tr><tr> <td>Subject*</td> <td width="300"><input type="Text" name="subject" value="" maxlength="50" class="textbox" style="width: 100%"></td> </tr><tr> <% 'Declare the ASP variables used Dim strFormName Dim strTextAreaName 'ID tag name of the HTML form the textarea is within strFormName = "frm3" 'ID tag name of HTML textarea being replaced strTextAreaName = "comment" %> <td valign="top">Comment*</td> <td width="300"> <!-- include the Web Wiz Rich Text Editor --> <!--#include file="RTE_editor_inc.asp" --> <textarea name="comment" id="comment" rows="6" cols="50" style="width: 100%;" class="textbox"></textarea> <input type="Checkbox" name="allowE" value="1" />Allow readers to email me. </td> </tr><tr> <td></td> <td><input type="Submit" value="Leave Comment" /></td> </tr> <input type="Hidden" name="mode" value="set" /></form> </table>





Replies:
Posted By: WebWiz-Bruce
Date Posted: 10 May 2007 at 8:22am
You need to tell it to focus on the new RTE area rather than the textarea that is replaced. To do this use:-

document.getElementById('WebWizRTE').contentWindow.focus();

You may need to place this into a part of the code that executes after the RTE has finished loading.


-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting


Posted By: julia444
Date Posted: 10 May 2007 at 9:03am

Thank you that works with a bit of modification. The javascript code is like this now

 <script langauge="javascript">
function Respond(){
opener.document.frm3.subject.value="RE:<%=SUBJECT%>";
opener.document.getElementById('WebWizRTE').contentWindow.focus();

}
              </script>
 
 
 
Could you (or anyone else) suggest what i should add to the above to solve another little problem which is:
 
When someone clicks reply to the code above, the cursor now focusus on the RTE area, however, if the page is a long one, and the form is at the bottom, then the user doesn't see the cursor. He may not know that he has to scroll to the bottom of the page, to see the comment form he has to fill in. this is because even though the cursor has move to the RTE area, the page is still there, in the same spot even though the pop up comment window has diminished.
 
It would be good, if when the cursor hits the text area, and the pop up page is diminished in the bottom of the page, THE PAGE FOCUS MOVES TO THE TEXT AREA TOO.
 
Would appreciate any tips as to what to add to the javascript code above to make this happen.


Posted By: WebWiz-Bruce
Date Posted: 10 May 2007 at 11:07am
Try using an anchor and reference the anchor in the URL

-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting


Posted By: julia444
Date Posted: 10 May 2007 at 1:05pm
Thank you BoRg, i will try that later,
 
I wonder if you have seen  this thread i started, but noonoe answered. The problem seems to be a simple one?? or maybe not??
http://forums.webwiz.net/forum_posts.asp?TID=23275&PID=122599#122599 - http://forums.webwiz.net/forum_posts.asp?TID=23275&PID=122599#122599
 
Again, many thanks.


Posted By: julia444
Date Posted: 11 May 2007 at 12:06pm
Originally posted by -boRg- -boRg- wrote:

Try using an anchor and reference the anchor in the URL
 
BoRg,
 
I'm not sure if using this would clash with the page
 
 <A name="WebWizRTE">[content ]</A>
 
and
 
    <BODY onLoad="location.href='#WebWizRTE';">
 
If i put the first code above, might it not clash with this,
<body OnLoad="initialiseWebWizRTE();">
 
Sorry, i'm not html literate,



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net