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

Question

Question

Is forms validation working correctly on the Address field?

asked on April 29, 2015

I have a form with an Address block which is designated as required. I am trying to hide the State / Country field using the Javascript technique described in the Laserfiche Forms Help section. (Feature Suggestion: You should take a look at how Gravity Forms manage their Address Block).

$(document).ready (function () {
$(".Country").parent().children().css('display', 'none'); 
})

I have not renamed or changed anything about the field using any other Javascript or CSS, so technically, this should work out of the box.

When using the form however, the Country Field is 'hidden', but the form will not validate. It shows a "required field" error, where the Country Field would normally be located.

The Address block is part of a "Company Details" section which is hidden until a check box is selected.

Any guidance would be appreciated.

 

Kind Regards,

 

 

0 0

Answer

SELECTED ANSWER
replied on April 30, 2015

Hi Kris,

The issue is related to the Address field being part of the field rule. The Address being inside a section doesn't have any bearing. We'll look into this.

In any case, Bert's workaround should get you past it for now.

$(document).ready (function () {
  $(".Country").parent().children().val(" ");
  $(".Country").parent().children().css('display', 'none');
})
4 0

Replies

replied on April 29, 2015

Try the following JavaScript. It removes the required attribute from the Country field.

$(document).ready (function () {
  $(".Country").parent().children().css('display', 'none');
  $(".Country").parent().children().removeAttr('required');
})
2 0
replied on April 29, 2015

Thanks for the tip Alexander.

 

Unfortunately, this didn't work either - see attached screen shot (apologies for resolution).

 

0 0
replied on April 29, 2015 Show version history

Are you using Forms 9.2.1? If not, then I'd suggest upgrading to that version. If you're still having an issue, please open a support case and provide a copy of your business process.

Here's a screenshot of what I see when I test a new form with only an address field with the above JavaScript:

Without the JavaScript that removes the required attribute, then I see the same thing you posted

0 0
replied on April 30, 2015

Hi Alex,

Just upgraded the server to 9.2.1 and it still isn't working. I'm still seeing the warning.

Can you try the above, but as per my example place the Address block within a section, and hide the section until a checkbox is ticked using a field rule?

Wondering whether there might be a conflict there?

Kind Regards,

 

 

0 0
SELECTED ANSWER
replied on April 30, 2015

Hi Kris,

The issue is related to the Address field being part of the field rule. The Address being inside a section doesn't have any bearing. We'll look into this.

In any case, Bert's workaround should get you past it for now.

$(document).ready (function () {
  $(".Country").parent().children().val(" ");
  $(".Country").parent().children().css('display', 'none');
})
4 0
replied on April 30, 2015 Show version history

Thanks Alex. Your code solves the issue.

0 0
replied on July 6, 2018

Alexander I am working on a form where I am trying to hide the country and I am having difficulties and wondered if you could help.  I have an online application for our members to fill out and I used this and it worked for my primary borrower which is always displayed but I also have a joint borrower address field that only displays their address field if it is a joint application and even with this it will not let me submit based on the joint borrower missing the country on the address.  Thoughts? Thanks!

0 0
replied on June 28, 2019

That remove required attribute doesn't seem to have any effect with back-end validation... but just defaulting the value to USA above (works for us) seems to have done the trick. Thanks!

0 0
replied on April 29, 2015

The way I have solved this for some of my customers is to fill the country field value through java during form load.

1 0
replied on April 30, 2015

Thanks Bert. This might be the only solution at this point.

0 0
replied on October 7, 2016

Just wanted to ping this post for the developers. This issue still occurs in 10.1.

 

My suggestion would be to change the functionality of the address forms control to allow you to turn off address line 2 and/or Country. Most of the time if you want anything removed from an address control it will be one of those two. 

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

Sign in to reply to this post.