#1 (permalink)  
Old 03-18-2008, 04:15 PM
echo@'s Avatar
Active Member
 
Join Date: Oct 2007
Location: UK Essex
Posts: 473
echo@ is on a distinguished road
Default minimum amount of words in text boxs

how can you set a minimum ammount of words for a textbox in indexu?

say 250 bare min for the description field?

Reply With Quote
  #2 (permalink)  
Old 03-18-2008, 04:28 PM
Bruceper's Avatar
Nicecoder Team
 
Join Date: Jun 2002
Location: Winnipeg Canada
Posts: 4,008
Bruceper is on a distinguished road
Default

<script>
function CheckLength()
{
var msg_area = document.getElementById("Message");
msg_area.innerHTML = "";
if (document.getElementById("comments").value.leng th < 20) {
msg_area.innerHTML = "YOU DID NOT ENTER ENOUGH INFORMATION";
}
else document.getElementById("testform").submit();
}
</script>

Modify to your requirements
Reply With Quote
  #3 (permalink)  
Old 03-21-2008, 08:11 PM
echo@'s Avatar
Active Member
 
Join Date: Oct 2007
Location: UK Essex
Posts: 473
echo@ is on a distinguished road
Default

these scripts only work if input type="button" not input type="submit".

indexu simply refuses to submit it the input type is set to button.

from what i can gather if the script was working with input type="submit" the user would recive the minimum ammount of character warning acordingly BUT the form would still submit anyway.

I have tried two scripts now but they require input type="button" to be enabled.

The next problem when i get this working will be knowing how to apply this to more than one <textarea>

good things come to those who struggle
Reply With Quote
  #4 (permalink)  
Old 03-21-2008, 08:21 PM
FSGDAG's Avatar
Moderator
 
Join Date: May 2007
Location: NJ, United States
Posts: 977
FSGDAG is on a distinguished road
Default

Code:
Content visible to License Owner only.
If that was true... I'd have the PERFECT life!
__________________
FSGDAG | IndexU Hosting | Owner
Website | NiceCoder Script Hosting and More! | Blog
General Directory | Deep Links Directory | Bidding Directory
Reply With Quote
  #5 (permalink)  
Old 03-25-2008, 05:07 AM
esm's Avatar
esm esm is offline
Active Member
 
Join Date: Apr 2003
Location: Atlanta GA
Posts: 3,411
esm is on a distinguished road
Default

Code:
Content visible to License Owner only.
are you looking for words or characters....???

if you are looking for characters, you can use javascript (getElementById) to test the length of field and change your onsubmit to return a true / false value. something like onsubmit="javascript:return ValidateMinFields(this)". Test as many fields as you like. If one fails the test, popup an alert message and the form is not submitted.

if you are testing for a minimum number of words, you will need to use the javascript split function instead of the length function.

then in the add.php/modify.php test the fields again using the PHP explode function to test for words or the strlen function to test for characters. (NEVER RELY SOLELY ON JAVASCRIPT TO VALIDATE A FORM). If they don't pass the test there, send the user back to the form with the appropriate message.




.
__________________
esm
"The older I get, the more I admire competence, just simple competence, in any field from adultery to zoology."

.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Importing large amount of data in a pre-existing database aladdin1 v5.x 8 06-16-2007 03:51 PM
Minimum soze of the description linksor.com Blocks and Modification 5 05-07-2007 03:16 AM
Amount of links displayed per page. lewisw v3.2 3 08-18-2003 07:12 PM
Ratings, limiting amount or deleting? starchdoggy Pre-Sales Questions 3 09-08-2002 02:33 PM
Hot links ! Amount ? Nanard Of Web Pre-Sales Questions 1 07-24-2002 02:30 PM

HACKER SAFE certified sites prevent over 99.9% of hacker crime.

All times are GMT -5. The time now is 04:47 PM.


Powered by vBulletin®
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO
SSL Certificate