Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - RTE made me lose focus on a field
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Forum LockedRTE made me lose focus on a field

 Post Reply Post Reply
Author
julia444 View Drop Down
Newbie
Newbie


Joined: 08 April 2007
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote julia444 Quote  Post ReplyReply Direct Link To This Post Topic: RTE made me lose focus on a field
    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>


Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
julia444 View Drop Down
Newbie
Newbie


Joined: 08 April 2007
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote julia444 Quote  Post ReplyReply Direct Link To This Post 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.


Edited by julia444 - 10 May 2007 at 9:10am
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 10 May 2007 at 11:07am
Try using an anchor and reference the anchor in the URL
Back to Top
julia444 View Drop Down
Newbie
Newbie


Joined: 08 April 2007
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote julia444 Quote  Post ReplyReply Direct Link To This Post 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??
 
Again, many thanks.
Back to Top
julia444 View Drop Down
Newbie
Newbie


Joined: 08 April 2007
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote julia444 Quote  Post ReplyReply Direct Link To This Post 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,
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.