You are viewing limited content. For full access, please sign in.



How to hide error text message using javascript?

asked on March 2, 2017 Show version history

 I have an SSN field that is required.  If the user selects Yes --- POA Mailed In then the SSN is not required.  If the user selects No --- POA Mailed In then the SSN is required.  How do I hide the error message Please fill out this field and make the box not red? I can remove the asterisk and make the field not required.  

   //If POA Mailed In = Yes, hide and un-require field
  //If POA Mailed In = No, un-hide and require field
  $('[name="Field224"]').change(function () {
    if($('#Field224-0').prop("checked")==true) {
      $('.reqField input').removeAttr('required');
    else if($('#Field224-1').prop("checked")==true) {
      $('.reqField label').append('<span class="cf-required">*</span>');
      $('.reqField input').attr('required', 'True');      


Thank you!!!!!

0 0


replied on March 2, 2017

Hi Mylene,

If you are using Forms 10.1 and below, add the following script when make the field not required:

$('.reqField .ws-errorbox').hide();
$('.reqField input').removeClass('user-error');

If you are using Forms 10.2, use the following script:

$('.reqField .parsley-required').hide();
$('.reqField input').removeClass('parsley-error');

Besides, for 10.2, the form backend validation need to be set to "no validation", otherwise submitting would fail.

0 0
replied on March 3, 2017

Thank you Rui!!! That worked perfect!!!!

0 0
replied on March 14, 2017

I used the solution above, and it works to remove the red color and message. But when the fields are set as required again, the red color and message don't return. Do I then have to add the parsley-error class onto the field again? Doing that makes it turn red right away. Is there a way to use the parsley().reset() method, which is suppose to set the field back to the original state?

0 0
replied on March 14, 2017

Yeah you could use $('#Field1').parsley().reset() for a certain field or $("#form1").parsley().reset() for the whole form.

Note that after reset the fields are not validated immediately (it will validate on blur or submit.) If you need the red color and message to show up immediately you could use $('#Field1').parsley().validate()

0 0
replied on November 22, 2017

Hi all,


I tried to apply your solution but unsuccess.


I just want to hide error message.


This is what i did :

$('.Field25 .parsley-error').hide();


Someone can help me?

Thanks in advance.



0 0
replied on November 22, 2017

Hi Olivier,

Is it a formula error? If so, the way for hiding error message would be different.

You may try:

$('#q25 .formula-error-list').hide();


0 0
replied on November 27, 2017 Show version history

Hi Rui Deng,


I suppose this is a formula error but i'm not sure. What is the others ways?

Anyway ; i tried without success :

$('#q25 .formula-error-list').hide();
$('.q25 .formula-error-list').hide();
$('#Field25 .formula-error-list').hide();
$('.Field25 .formula-error-list').hide();

I still have the same error.


I used Calcul to get value.


Idk if this could help.


0 0
replied on November 27, 2017

Hi Olivier,

Since it's formula error, you need to trigger hiding formula error when the formula reference fields change (they are Return_Date and Beginning_Date as your formula shows).

So the whole script would be like:

  $('li[attr=Return_Date] input').change(clearFormulaError);
  $('li[attr=Beginning_Date] input').change(clearFormulaError);
  function clearFormulaError()
    $('#q25 .formula-error-list').hide();
    $('#q25 input').removeClass('formula-error');


0 0
replied on June 4, 2018

Hi Rui, 


Thanks for the information provided, I am looking for something similar where I have a calculation happening based on (Required*Price)-(Discount%) which works perfectly but I am seeing the following before any data is entered: 


Is there any way I can hide that as the fields have not been populated yet? 

Basically, the form is started by the user selecting the Customer which has a % discount, once that is shown, the error is displayed. It is then cleared once you enter the Required and the price as the calculation is then valid, 


Is there a way I can remove that even after the customer is selected? 



Thanks in advance,


0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.