miniBB ® 

miniBB

®
Support Forums
  
 | Start | Register | Search | Statistics | File Bank | 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
Active Member
#1 | Posted: 7 Apr 2009 22:25 
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
Active 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 Support Forums / Custom Tutorials and Modifications /
 Insert cursor in the text form on page load (but without focus)
 Share Topic's Link

Your Reply Click this icon to move up to the quoted message


  ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.

 

 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Try the Captcha add-on: protect your miniBB-forums from the automated spam and flood.


  ⇑