miniBB ® miniBB®
miniBB Support Forums
 | Forums | Register | Reply | Search | Statistics | Manual |
Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /   

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

Author tom322
Registered
#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
Lead Developer
#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
Registered
#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 Support Forums / 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

 Short link for this topic:

 ?
Only registered users are allowed to post here. Please, enter your username/password details upon posting a message, or register first.


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 Support Forums Powered by Forum Software miniBB ® Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contacts
Get the Captcha add-on: protect your miniBB-forums from the automated spam and flood.
Captcha Addon for miniBB