This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 3

Editing error message in submission of required fields


  1. inkpotprinting
    Member

    Hi

    Is it possible to get rid of "There was a problem with your submission. Errors have been highlighted below." when people don't fill in required fields? I think the red highlighting and "This field is required. Please enter a value." is sufficient for what we need, and the big box at the top makes the form too long.

    Thanks!

    Posted 11 years ago #
  2. yuniar

    You can edit "includes/view-functions.php" file, search around line 4336-4341 for this block of code:

    $form->error_message =<<<EOT
    			<li id="error_message">
    					<h3 id="error_message_title">{$mf_lang['error_title']}</h3>
    					<p id="error_message_desc">{$mf_lang['error_desc']}</p>
    			</li>
    EOT;

    simply remove that block of code.


    MachForm Founder

    Posted 11 years ago #
  3. inkpotprinting
    Member

    Thank you!

    Posted 11 years ago #
  4. inkpotprinting
    Member

    OK I just tried this Yuniar, the code in my view-functions.php looks a bit different to yours. Lines 4324 to 4336 have this:

    if(!empty($custom_error)){
    			$form->error_message =<<<EOT
    			<li id="error_message">
    					<h3 id="error_message_title">{$custom_error}</h3>
    			</li>
    EOT;
    		}elseif(!empty($error_elements)){
    			$form->error_message =<<<EOT
    			<li id="error_message">
    					<h3 id="error_message_title">{$mf_lang['error_title']}</h3>
    					<p id="error_message_desc">{$mf_lang['error_desc']}</p>
    			</li>
    EOT;

    Which bits should I change/delete?

    Posted 11 years ago #
  5. inkpotprinting
    Member

    Please ignore me, I am an idiot. That worked perfectly, thanks for your help!

    Posted 11 years ago #
  6. jblackburn
    Member

    With version 4, is this still the best method? I don't like editing the code as it is one more thing to have to remember when you upgrade. (Like the old custom-hooks hack).

    Posted 10 years ago #
  7. yuniar

    You can simply add CSS code into your form's theme for that.
    Add this code:

    #error_message {
      display: none !important;
    }

    that should hide the error message from your form, without the need of modifying any file.


    MachForm Founder

    Posted 10 years ago #
  8. inkpotprinting
    Member

    Thanks Yuniar, that CSS works great. Is there any way to also get rid of "This field is required. Please enter a value."? I think that simply having a red box is enough to alert the user to the problem.

    Posted 9 years ago #
  9. yuniar

    Having the red box color without any message would confuse people, in my opinion. However, if you prefer to do this, you can edit the "includes/language.php" file. Search for this code:

    $languages['val_required'] 	=	'This field is required. Please enter a value.';

    and change it to become:

    $languages['val_required'] 	=	'';

    MachForm Founder

    Posted 9 years ago #

RSS feed for this topic

Reply