Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: minimum words

  1. #1
    Regular Coder
    Join Date
    Aug 2003
    Location
    scotland, edinburgh
    Posts
    176
    Thanks
    5
    Thanked 1 Time in 1 Post

    minimum words

    I have seen some jvavascript like http://www.felgall.com/jstip42.htm where it counts the words as you type, but what i want it a reverse a countdown from 500 where after that they can post the item.
    Why post here I hear you ask
    Well I have heard that you can easily disable the javascript and then be able to post as little words as you want and so they suggested a serverside language like php so is there any chance of php being able to do that kind of thing?
    Any advice or help is welocomed

  • #2
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,055
    Thanks
    10
    Thanked 95 Times in 93 Posts
    not in the same way , you can count words in a string using PHP but not until the user has submitted the form, so you can not do it in real-time, but imagine a form textarea field <textarea name="content">

    then in the form's `action` page ...
    PHP Code:
    <?
    $count
    =countexplode' ' $_REQUEST['content'] ) ) ;
    if( 
    $count >= 500 ){
        echo 
    $count .' words submitted ';
    }else{
       echo 
    'content was less than 500 words (' $count ')';
    }
    ?>
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #3
    Regular Coder
    Join Date
    Apr 2004
    Posts
    298
    Thanks
    0
    Thanked 23 Times in 23 Posts
    Have you tried modifying the javascript? it appears (and I could be dead wrong since I am close to clueless about writing javascripts) that the variable 'r' in the script is the actual counter. If you were to change r = 0 to r = 500 and the change r ++ to r -- , that would cause the counter to work in reverse order from 500 down.

    just a thought


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •