Search code examples
phpwordpressdmspagelines

How can I limit the amount of letters or characters someone can enter on job posting forms?


I am running a job board and individuals can post jobs. On my Post a job page, the title where the user enters in the title of a job he/she is posting (ex. warehouse worker) does not have a max length to limit the amount of characters or letters they use.

In result, the words run across the page and over laps other content on that page. How can I fix this?

The guy who created this job board gave me this code to fix it, but I have no idea in what file to place it in. I've been given very limited information

add_filter("wpjb_form_init_job", "my_wpjb_form_init_job");
function my_wpjb_form_init_job($form) {
    $form->getElement("job_title")->addValidator(new Daq_Validate_StringLength(1, 80));
    return $form;
}

Solution

  • <input type="text" maxlength="15" id="textfield" name="textfield"  />  //you can put any length says 10,15.etc