How To Disable A Mandatory Field from Being MANDATORY

WordPress Business Themes Forums Responsive Themes Directory Theme How To Disable A Mandatory Field from Being MANDATORY

How To Disable A Mandatory Field from Being MANDATORY

September 15, 2017
Jason Jason
  • Jason
    Jason
    Titan 771 points

    Hi Guys’n Gals

    May I ask a little help here pls..

    I’d like to know how to stop the DESCRIPTION in Directory Theme section from being Mandatory field, otherwise hiding the DESCRIPTION section wont work, how to stop from being MANDATORY ?

    Pic attached for no confusion to my question

    Attachments:
    You must be logged in to view attached files.
    September 15, 2017 at 7:37 am
  • Jason
    Jason
    Titan 771 points

    Thanks in advance

    September 15, 2017 at 7:38 am
  • Josh
    Josh
    Super Guru 13,887 points

    Hello Jason,
    Please access the file Appearance >add-form.php remove below code


    if(de3.value == ''){
    alert('<?php echo $CORE->_e(array('validate','0')); ?>');
    de3.style.border = 'thin solid red';
    de3.focus();
    colAll(); jQuery('.stepblock2').collapse('show');
    return false;
    }

    September 15, 2017 at 1:23 pm
  • Jason
    Jason
    Titan 771 points

    I have noticed that this actually disables MANDATORY fields sitewide not just the DESCRIPTION section, is that what it does disables every mandatory field, was just hoping the description only ?

    September 15, 2017 at 10:51 pm
  • Josh
    Josh
    Super Guru 13,887 points

    Hello Jason,
    Which other fields are getting affected?Seems ok on my end

    September 18, 2017 at 2:03 pm
  • Jason
    Jason
    Titan 771 points

    I hues what i want, is for certain fields to appear as the the TITLE. I know i add them in page setup, but when completing the form it demands I enter into the TITLE section, I dont want that

    November 11, 2017 at 5:21 am

  • Janak
    Super Guru 1,277 points

    Hi Jason

    Have you tried setting Min. Description Length to 0 in Listing Setup Options?

    November 11, 2017 at 9:52 am
  • Jason
    Jason
    Titan 771 points

    Its the TITLE, I already dealt with Description while ago, thanks Janak

    November 11, 2017 at 10:40 am

  • Janak
    Super Guru 1,277 points

    I’m not sure why you would want to allow a blank Title but you can probably do it by making a small mod in each of add-form.php and tpl-add.php, You can then place the modified copies in your child theme. I’ve not tested it though.

    If you need any help with this let me know.

    November 11, 2017 at 12:53 pm
  • Jason
    Jason
    Titan 771 points

    This is all I want to happen, as remove the completion of the ORIGINAL TITLE so my own CUSTOM FIELDS can become the TITLE

    This becomes the TITLE instead

    http://prntscr.com/h99oj0

    http://prntscr.com/h99qcx

    November 11, 2017 at 11:06 pm

  • Julian
    Newbie 90 points

    thats kinda cool what ya want…please post if ya get the answer..I may use that in future..I remember I was usingg some code awhile back that manipulated the titles and stuff I wish I could remember for you…i had it saved in note pad but computer had to be formatted so lost it all arrggg…but please do post if ya get answer..I think that’s brilliant!

    November 12, 2017 at 10:46 am

  • Janak
    Super Guru 1,277 points

    You could try:

    In add-form.php

    Comment out required line in following code

    $field = array();
    $field[$o]['title'] = $CORE->_e(array('add','10'));
    $field[$o]['name'] = "post_title";
    $field[$o]['type'] = "text";
    $field[$o]['class'] = "form-control";
    // $field[$o]['required'] = true;
    $field[$o]['ontop'] = true;
    $field[$o]['placeholder'] = hook_add_post_title_text("");

    Add return true; in following code

    // LISTING DESCRIPTION VALIDATION
    var de1 = document.getElementById("form_post_title");
    return true;
    if(de1.value == ''){
    alert('<?php echo $CORE->_e(array('validate','0')); ?>');
    de1.style.border = 'thin solid red';
    de1.focus();
    colAll(); jQuery('.stepblock2').collapse('show');
    return false;
    }

    In tpl-add. find following code and change 2 to 0;

    // VALIDATION
    if(strlen($_POST['form']['post_title']) < 2){
    $GLOBALS['error_message'] = $CORE->_e(array('add','23'));

    It seems to work but I haven’t tested any implications in the system so no guarantees. You could remove Title completely from add-form.php.

    November 12, 2017 at 1:18 pm
  • Jason
    Jason
    Titan 771 points

    OK,,,,,,,,,,,,

    This is what I done, all worked, but it removed the javascript piece that i really liked

    Here below are 5 images on what I done.

    All worked, except like I said, removed something I like in image 1.

    Image 1: http://prntscr.com/h9ndng

    Image 2: http://prntscr.com/h9ne0p

    Image 3: http://prntscr.com/h9ne5r

    Image 4: http://prntscr.com/h9neg4

    Image 5: http://prntscr.com/h9nggm

    Low and behold, all seems like a great idea, can work in some sites thene again some sites might need the TITLE to be used. In my case dont need title.

    Hope this also helps you all out, and thanks for the heads up in playing with the php files

    Test these out yrselves on a dummy site

    November 12, 2017 at 11:42 pm
  • Josh
    Josh
    Super Guru 13,887 points

    Thanks for sharing Jason :)

    November 13, 2017 at 3:04 pm

  • Julian
    Newbie 90 points

    awesome!! Thanks Jason

    November 13, 2017 at 8:56 pm
Viewing 15 posts - 1 through 15 (of 15 total)

Didn't find what you were after?

Chat with us now

or contact our support team