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

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

Costumize Error Messages


  1. Ajaxriver
    Member

    Hi, is it possible to costumize an error message to a single field?
    I need a special Error Message to my {element_3}.
    Thanks
    JM

    Posted 15 years ago #
  2. AMurray
    Pro Member

    "costumize"? I assume you mean "customize", or "customise" for those outside the U.S.

    From a quick search I found some of the error messages in the language.php file in the "includes" folder - there may be more and perhaps someone else can point you in the right direction.

    The general errors (or some of them) are listed from about line 60 onwards. The validation messages are from about line 72

    However these will be global changes.

    I'm not sure what type of error you want to add - can you explain in more detail what you need?

    Posted 15 years ago #
  3. Ajaxriver
    Member

    Hi AMurray
    Thanks for your reply.

    Yes, customise... (sorry for my poor english).
    I was way from computers for a few days, now i'm back.
    --
    I did the translation of language.php file to portuguese.

    In one of my forms i have a radio button that is mandatory and i need a specific error message for this field if it is not selected.

    Is it possible?

    J Morais

    Posted 15 years ago #
  4. redityo

    Hi,

    To get different error message of your radio field, you can edit "includes/post-functions.php" file. Go to around line 212 ~ 214 and you'll find these code :

    if($validation_result !== true){
    	$error_elements[$element_id] = $validation_result;
    }

    try to put this code, exactly bellow that line

    if ($form_id == 7 && $element_id == 3) {
    	if (!empty($error_elements[$element_id]))
    	{
    		$error_elements[$element_id] = "This error is different";
    	}
    }

    In there, I assume your element id = 3 on form id = 7


    MachForm Support

    Posted 15 years ago #
  5. Ajaxriver
    Member

    It works great!
    Your support is absolutely fantastic.

    Thanks for that

    JMorais

    Posted 15 years ago #

RSS feed for this topic

Reply