Jump to the post that solved this thread.
Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Solved: 6 Years, 3 Months, 2 Weeks ago maxlenght conditional check
#1
Solved: 6 Years, 3 Months, 2 Weeks ago
Please help, How to check if the maxlenght has the correct value before submitting?

I set maxlenght="50" but people will use Firebug to modify that so I want to some how maybe with conditional template check if the input value is not more that 50?
#2
Solved: 6 Years, 3 Months, 2 Weeks ago
Well, you would have to check it serverside (with PHP, strlen on $mybb->input['xxx'] or whatever) and throw error if it's too long, maxlength isn't even supported in IE < 8.. Can't do it with Template Conditionals, need plugin/core modification. Neither can it be done with XThreads @down.
#3
Solved: 6 Years, 3 Months, 2 Weeks ago
This is the line I want to restrict to max 50 characters
<input type="text" class="textbox" name="subject" size="40" maxlength="50" value="{$subject}" tabindex="1" />

Can I do it with xthreads?


Can I use something like this for conditional?
if($subject_length > 50)
        {
            // Subject is too long
            $this->set_error('subject_too_long', my_strlen($subject));
            return false;
        }
#4
Solved: 6 Years, 3 Months, 2 Weeks ago
The easiest way would be to edit inc/datahandlers/post.php

if($subject_length > 85)
		{
			// Subject is too long
			$this->set_error('subject_too_long', my_strlen($subject));
			return false;
		}
Change 85 to your value.
#5
Solved: 6 Years, 3 Months, 2 Weeks ago
Destroy do you know if I can do it with JavaScript form validate? Any good JavaScript code that will work with all the browsers?
Jump to the post that solved this thread.


Forum Jump:


Users browsing this thread: 1 Guest(s)