Mind blowing SEO improving and Google rank increasing Signature Rotator SEO Tool.

Thread: 

How to get Posting in check like in letsforum ?

Ads
banner
banner
banner
Evanto Offline referral

Posts: 14
Joined: Jan 2014
Reputation: 1

#1
Junior Member
In letsforum we see there is a checkbox before posting a thread
How to implement it ?
I know there is a plugin for checkbox validation but i want to get something similar to letsforum
Hoping for an answer
victor Offline referral

Posts: 638
Joined: Jun 2013
Reputation: 33

#2
Senior Member
Well it easy man you just need to disable the input field then add a JavaScript checkbox so that when the checkbox is checked the input field gets enabled.

You can try this:
First backup your newthread template
Open your newthread template, somewhere in the template add this code:

PHP Code:
<script>
function 
enable_text(status) {
    
status = (status) ? false true
    
document.form1.other_name.disabled status;
}
</script> 

Add this code to where you want your checkbox to show

PHP Code:
<tr>
<
td class="trow2" width="20%"><strong>YOUR TEXT HERE</strong></td>
<
td class="trow2"><input type="checkbox" name="others" onclick="enable_text(this.checked, 'mycheckbox')"/>SOME MORE TEXT</td>
</
tr

Now find:

PHP Code:
<input type="text" class="textbox" name="subject" size="40" maxlength="85" value="" tabindex="1" /></td

And add to it id="mycheckbox" disabled="disabled" it should look like this:

PHP Code:
<input id="mycheckbox" disabled="disabled" type="text" class="textbox" name="subject" size="40" maxlength="85" value="" tabindex="1" /></td
marcus_avrelius Offline referral

Posts: 2,424
Joined: May 2013
Reputation: 102

#3
Support Team
Sorry for such a late reply I was away from home.
You don't need a plugin for this, just as Victor mentioned above you need to disable the input field then add a checkbox to enable it, let me show you how you can do it!

Open your newthread template which is in ACP >> Templates & Style >> Templates >> Your Template >> New Thread Templates >> newthread
Above </head> add this code or similar one:

PHP Code:
<script type="text/javascript">

  function 
enableText(checkBooltextID)
  {
    
textFldObj document.getElementById(textID);
    
textFldObj.disabled = !checkBool;
    if (!
checkBool) { textFldObj.value ''; }
  }

</script> 

Find {$loginbox} and after it add this code or similar one:

PHP Code:
<tr>
<
td class="trow2" width="20%"><strong>some text</strong></td>
<
td class="trow2"><input id="myCheckBox" type="checkbox" onclick="enableText(this.checked, 'myTextArea');"/>some text</td>
</
tr

Now find this code:

PHP Code:
<tr>
<
td class="trow2" width="20%"><strong>{$lang->thread_subject}</strong></td>
<
td class="trow2">{$prefixselect}<input type="text" class="textbox" name="subject" size="40" maxlength="85" value="{$subject}tabindex="1" /></td>
</
tr

And replace it with this one:

PHP Code:
<tr>
<
td class="trow2" width="20%"><strong>{$lang->thread_subject}</strong></td>
<
td class="trow2">{$prefixselect}<input id="myTextArea" type="text" disabled="disabled" class="textbox" name="subject" size="40" maxlength="85" value="{$subject}tabindex="1" /></td>
</
tr

And that is it, I used Victor JavaScript but you can use your own if you wish!!!!
Looking for ways to make money fast? Read this article and start earning money todya fast, easy or for free.
destroyer Offline referral

Posts: 430
Joined: Jul 2013
Reputation: 3

#4
Senior Member
I am not an expert here but it looks like you both made a mistake here, you posted disabled="disabled but it should be disabled="disabled" Smile
marcus_avrelius Offline referral

Posts: 2,424
Joined: May 2013
Reputation: 102

#5
Support Team
Thanks @Destroy for correcting me I have just updated my reply
Looking for ways to make money fast? Read this article and start earning money todya fast, easy or for free.
Evanto Offline referral

Posts: 14
Joined: Jan 2014
Reputation: 1

#6
Junior Member
I used above example but it didn't work out for me, the subject field is disabled i guess even after i click checkbox

I am using default MyBB theme, i can't post content of my template so i sent a PM to marcus
marcus_avrelius Offline referral

Posts: 2,424
Joined: May 2013
Reputation: 102

#7
Support Team
I am sorry but the reason it doesn't work is because of the JavaScript, I have just updated my reply it should work now!
Looking for ways to make money fast? Read this article and start earning money todya fast, easy or for free.
victor Offline referral

Posts: 638
Joined: Jun 2013
Reputation: 33

#8
Senior Member
You can use this method to enable input filed or text field with checkbox
PHP Code:
<html>
<
head>
</
head>
  <
body>
<
input type="checkbox" onclick="document.getElementById('directory_entry_name').disabled=!this.checked;" id="directory_entry" />
<
input type="text" id="directory_entry_name" disabled="disabled" />
   </
body>​​​​
</html
Evanto Offline referral

Posts: 14
Joined: Jan 2014
Reputation: 1

#9
Junior Member
Thanks a lot marcus_avrelius , it works awesome Wink
marcus_avrelius Offline referral

Posts: 2,424
Joined: May 2013
Reputation: 102

#10
Support Team
Thanks very much @Evanto I am glad it works Wink if you have any further questions related to MYBB templates please feel free to post a new topic.
Looking for ways to make money fast? Read this article and start earning money todya fast, easy or for free.
Evanto Offline referral

Posts: 14
Joined: Jan 2014
Reputation: 1

#11
Junior Member
There is a bug with this, if we preview the post after writing subject and message then the checkbox doesn't stay
Can you give a solution on this ?
ivan Offline referral

Posts: 713
Joined: Jul 2013
Reputation: 6

#12
Senior Member
It's better this way because spammers might use preview post to bypass this checkbox !
marcus_avrelius Offline referral

Posts: 2,424
Joined: May 2013
Reputation: 102

#13
Support Team
That is correct spambots will use it to bypass this feature so just leave it the way it is!
Looking for ways to make money fast? Read this article and start earning money todya fast, easy or for free.





User(s) browsing this thread: 1 Guest(s)