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

Question

Question

Database Lookup Returns Nothing but Satisfies Required Fields?

asked on November 20, 2015

I have a Laserfiche form that asks for an employee's email address. Once the email address is entered it does a database lookup for the employee's name and employee number (both required fields). If the employee enters in an incorrect email address (one that does not exist in the database) the name and employee number fields show nothing, however they are still able to submit the form.

Why if the lookup didn't find a matching value for the email address would it allow for the form to be submitted when there are no values returned for the 2 required fields?

2 0

Replies

replied on April 19, 2016

I just read the release notes for Forms 10.1 and saw this line:

The Required and Read-only field options are no longer mutually exclusive for Single Line, Multi-line, Drop-down, Number, Email, Date, and Currency fields.

Thank you!!!

2 0
replied on November 18, 2016


So, are you saying that LF 10.1 has now fixed it so that Forms with empty "required fields" cannot be submitted?

0 0
replied on November 20, 2015

Hey Blake,

 

what would be the full version/build of your forms? Also if you were to create a blank new set up as a test would the same issue persist? I was unable to recreate the issue on 9.2.1.1069. 

1 0
replied on November 20, 2015 Show version history

We are on Forms version 9.2.1.1069. Upon further testing, we have the following custom JavaScript that seems to be causing the problem:

//make fields with read-only class read-only
  $('.read-only input').attr('readonly',true);
  $('.read-only select').attr('disabled',true);

With that custom JavaScript, it marks the input fields as read only, but apparently that makes it so Forms does not validate a value in the field as well. Any suggestions on to correct that but still make the field read only?

0 0
replied on November 23, 2015

Does anyone have any suggestions on how to mark a field read-only, but still making the field required?

0 0
replied on November 23, 2015 Show version history

Hi there,

If a field is read-only, it cannot be required at the same time. This is due to user who fills the form has no control over the read only field data which populated automatically by design.

1 0
replied on November 23, 2015 Show version history

That functionality would be extremely useful for lookups though. Example: I have a form with a first and last name fields. The end user starts to type in the last name and then selects a name from the popup list. The end user then does the same thing for the first name. If they end up typing in a name that does not match one in the list, the read-only fields do not get populated from the lookup. The read-only fields however are required when saving the form to the repository to make sure it gets saved in the employee's correct folder.

Even if using a drop-down list that is populated from a lookup, some times the lookup for the read-only fields does not populate because it is missing from the HR database. In that case, it tells the end user that they need to contact HR to update their information.

It would be extremely useful if a field could be required and read-only at the same time.

2 0
replied on November 23, 2015

Hi there,

Thanks for the use case! I'll bring this to Development and enhance the feature.

1 0
replied on November 23, 2015

Hi,

I have a similar situation. I tried making the fields readonly and required through javascript.

$(".FA_Act_fee input").attr('required', 'true');

$(".FA_Act_fee input").attr('readonly', 'true');

 

They work perfect when used individually, but when used together, the field is accepting empty values.

Can you provide any solution?

0 0
replied on November 23, 2015 Show version history

The only way I see around this is to use some custom javascript code. Basically you would need to hijack Forms validation method and implement your own. In order to stay compliant, we would still call Forms' native validation function. First thing you will need to do is replace the submit button with your own. I will copy Eric Cressey's code from this post (https://answers.laserfiche.com/questions/64069/How-to-Integrate-Font-Awesome-with-Forms​) as he beautifully outlines how to do it. Add a "Custom HTML" control and add it to the bottom of the page. Then add this html to the custom HTML:

<button class="Submit">Submit</button>

The CSS:

input.Submit {display:none;}

And finally the Javascript. Now you can either be very generic here and simply say that all fields that are required and are readonly need to be validated or reference specific fields. For this example, I will show the generic way:

$(document).ready(function() {
    function checkValidation() {
        return $('input[class*=cf-],select[class*=cf-]').map(function() { if (($(this).prop('disabled') || $(this).prop('readonly')) && $(this).prop('required') && !$(this).val()) return $(this).addClass('user-error'),true;}).length==0 && $('form.cf-form').checkValidity();
    }

    $(document).on('click','button.Submit', function() {
       if (checkValidation()) $('input.Submit').trigger('click');
    });
});

Note: if the field is marked "readonly", Forms will not save its' value. You will need to "unmark" these fields in the "checkValidation" function before you trigger the "input.Submit" button.

0 0
replied on November 20, 2015

To troubleshoot, I would open dev tools and after the lookup, type "$('li[attr=[variablenameoffield]] input.singleline').val()" and see what output you get. Possibility that your lookup is returning empty space characters and if your field does not have a character limit or regex validation, it will except empty space for valid input.

0 0
replied on November 23, 2015

Hi there,

We've confirmed this is a bug in 9.2.1, and this bug will be fixed in the next release of Forms.

replied on November 23, 2015

Does that mean the official release of Forms 10 or Forms 10.0.1?

replied on November 23, 2015

It'll be the minor release version after Forms 10.

You are not allowed to follow up in this post.

Sign in to reply to this post.