Skip to:
Content
Pages
Categories
Search
Top
Bottom

check text before sending


  • hotuhai
    Participant

    @hotuhai

    Hi, I have a great bbpress site, But how to check the text before submitting?
    I want the user to write at least 500 characters before they can press submit.
    I used the bbp_new_topic_pre_content hook but now I want them to not be able to press submit before being eligible.
    Do you have any solution?
    Many Thank

Viewing 4 replies - 1 through 4 (of 4 total)

  • Robin W
    Moderator

    @robin-w

    This might be the same as you are saying you don’t want – the user can press the submit, but it returns an error. As close as you’ll get without some js.

    function rew_min_length ($reply_content) {
    	if (strlen($reply_content)<500) {
    		bbp_add_error( 'bbp_reply_content', __( '<strong>ERROR</strong>: Your reply must be at least 500 characters.', 'bbpress' ) );
    	}
    return $reply_content ;
    }
    
    add_filter( 'bbp_new_reply_pre_content', 'rew_min_length' );

    hotuhai
    Participant

    @hotuhai

    Thank you very much, but this is not what I need,
    You and I were basically the same thing with different hooks.
    However, we still have to send the request to check after pressing the submit button.
    I don’t want that to happen.
    I am looking for a solution to not show the submit button when it is not eligible.
    I was thinking of javascript, however, it depends on the client. Any ideas in this direction?
    Thank you.


    Robin W
    Moderator

    @robin-w

    sorry, well beyond free help, but in essence this is just an html form, so a bit of googling should let you create some js.


    Robin W
    Moderator

    @robin-w

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Skip to toolbar