miniBB ®
 
miniBB Community Forum
 | Forums | File Bank | Sign Up | Reply | Search | Statistics | Manual |
Premoderation addon for miniBB Worried about forum enemies? Pre-approve postings and members with the Premoderation add-on!
Custom Tutorials and Modifications miniBB Community Forum / Custom Tutorials and Modifications /
Short link for this topic:

Insert cursor in the text form on page load (but without focus)

Author tom322
Forums Member
#1 | Posted: 7 Apr 2009 22:25 | Edited by: tom322
I'm trying to insert cursor in the post form by default when user opens a page. I could do it correctly by inserting a code in the <body> tag, but it wasn't exactly what I wanted because then the user is taken down to the form whenever page is opened.

So I tried another method (about the same as it is now when entering captcha on the authorize page):

<script type="text/javascript">
<!--
document.postMsg.postText.focus();
//-->
</script>

I included the above code in the main_post_area.html (also tried main_post.html), but it didn't work either. There was this javascript error:

Message: 'document.postMsg.postText' is null or not an object

Is there a way to do it correctly? If it's something tricky, maybe it could be done by using the paste_strinL function (but then not sure if it's possible to do it on the topic page too).

Thank you.
Author Paul
CEO
#2 | Posted: 8 Apr 2009 03:00
tom322:
the user is taken down to the form whenever page is opened

I suppose this is how it will work on focus always. You can't set the focus without moving to the form itself.

Just entering such JavaScript code is quite rude solution. You must take into attention closed topics where the form doesn't appear.

This code also should be pasted below the form. Also I would prefer to refer to document.forms['...'].elements['...'], or may be you should experiment with "id"/"name" tags of the form, if any of those tags is missing, you may try to add it.
Author tom322
Forums Member
#3 | Posted: 8 Apr 2009 09:43
Paul:
I suppose this is how it will work on focus always. You can't set the focus without moving to the form itself.

Hm, if it's always going to work this way then it's not an acceptable solution so I had better skip it ;). Thanks.
Custom Tutorials and Modifications miniBB Community Forum / Custom Tutorials and Modifications / Insert cursor in the text form on page load (but without focus) Top
Your Reply Click this icon to move up to the quoted message

» Username  » Password 
You are welcome to post anonymously by entering a nickname with no password (if that nickname has not been taken by another member) or by leaving both fields empty. If you have a forums membership account, you can also sign in from this page without posting a message, or sign in and post at once.


Before posting, make sure your message is compliant with our forum posting rules. If not, it may be locked or deleted with no explanation.

 
miniBB Community Forum Powered by Free Forum Software miniBB ® Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contacts