• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Error Message - Change depending on various case

Error Message - Change depending on various case 11 years 10 months ago #24009

  • lking
  • lking's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 24
Hello,

Just wanted to ask how do we change different error message like "Please complete all required fields!" depending on various cases like the following example:

First name*: Test
Last name*:
Email address*: This e-mail address is being protected from spambots. You need JavaScript enabled to view it

So if the above fields are all required and user didn't fill up the field - Last name, how do we change the error message by default as "Please complete all required fields!" to "Please enter your last name!" or changing it to "Please enter your email address!" accordingly.

Thank you,

Regards,
Josh
Last Edit: 11 years 10 months ago by lking.
The administrator has disabled public write access.

Error Message - Change depending on various case 11 years 10 months ago #24010

  • anthony.burge
  • anthony.burge's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 16
  • Thank you received: 3
You want to change the validation message. The error messages you are talking about appear when the fields are not validated.

You probably noticed that when you made a new field there was a tab called Validations
Click on it and then edit the validation message.

If you have already created the field, click the edit icon, then click on the validation tab then change the validation message.
The administrator has disabled public write access.

Error Message - Change depending on various case 11 years 10 months ago #24012

  • lking
  • lking's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 24
Hello,

It is actually the top message that will appear like the following example that can be set in "Form info -> error message". This message can only set once and will only show the same message when the the form is unable to pass the validation process. Somehow, I just wonder how do we change this message (Please complete all required fields!) based on various case like when the last name field is empty then show (Please enter your last name!) or depending on various cases.

"Please complete all required fields!"
First name*: Test
Last name*: (for example: "Invalid field" - the validation message)
Email address*: This e-mail address is being protected from spambots. You need JavaScript enabled to view it

Is this possible to achieve?

Thanks

Regards,
Josh
Last Edit: 11 years 10 months ago by lking.
The administrator has disabled public write access.

Error Message - Change depending on various case 11 years 10 months ago #24014

  • anthony.burge
  • anthony.burge's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 16
  • Thank you received: 3
Ahh I get you, sorry for the misunderstanding!
The administrator has disabled public write access.

Error Message - Change depending on various case 11 years 10 months ago #24015

  • lking
  • lking's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 24
Hello,

Yup.. that's the one that I need it to change according to various cases but still can't find any solution. I think we need some programming codes here but I'm not sure what is the variable name to change this message. Anyway Thanks for trying to help.. ;)

Regards,
The administrator has disabled public write access.

Error Message - Change depending on various case 11 years 3 months ago #26398

  • seal305
  • seal305's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 20
  • Thank you received: 1
This is working for me:

In the javascript block put
 
<script type="text/javascript">
//<![CDATA[
 
var errorMsg = "Missing Required Field!";
function changeError() {
	document.getElementById("FormError").innerHTML =  errorMsg;
}
//]]>
</script>

Then in the php process block
 
if ( !$invalid ) {
    //no fields were invalid
    //create your own message
    echo'<script type="text/javascript">errorMsg = "Please check fields below";</script>'; //replace error at top
    $invalid[] = RSFormProHelper::getComponentId("name"); //cause field "name" to be flagged as invalid
} else {
    echo'<script type="text/javascript">errorMsg = "Please check fields below";</script>'; //"default" message
}
 

Note: if the "thank you" page or redirect is set, this may not display anything.

Thanks to Kyle.Benedetti for the js.
Last Edit: 11 years 3 months ago by seal305.
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!