So I have a field on my form that displays the current user, it is read only.
It works correctly while filling the form out.
But every step after I submit, the current user is blank. Even when saved to the repository.
Any ideas?
So I have a field on my form that displays the current user, it is read only.
It works correctly while filling the form out.
But every step after I submit, the current user is blank. Even when saved to the repository.
Any ideas?
I fixed the problem by deleting the field and recreating it. Seems like a bug that should be fixed.
Rex,
If you are making the field readonly on the layout section, don't. Instead, put a line in the top of your JavaScript section making it read-only:
$('#Field37 input').prop('readonly', true);
THEN, put a function in the bottom of your javascript section for the Submit button to make the field not be read-only and it will then save the value. Do it like this, in this case we assume the Field number is 37:
$('.Submit').click(function(){
$("#Field37 input').prop('readonly', false);
});
Which version of Forms are you running? I believe some older versions had an issue that caused those values not to be saved, but it should be resolved.
I'm on 10.3.1 and a read-only field populated with the same default value populates correctly. I've been using those variables in read-only fields since at least 10.2 or 10.1 and I don't recall any issues.
I'm on 10.3.1 as well
That's odd. Where exactly did you set it to be read-only?
I would also go to the monitoring section, open one of the instances, and make sure the variable is actually blank.
I just tested it again with a secondary user task and the value is carrying over to the next step without any issues.
I set it to be read only in the field options.
As for the monitoring, the variable is actually blank.
Rex,
I have had the same issue with 10.2 and every other version...if you are typing a value into the field and it's set to readonly in the Layout section you are fine, but when the value is being filled by a variable after the form loads, I always have to make it readonly through the javascript rather than the layout field setting like above...then if you change it after the submit button is clicked it saves it. Try it.
I am having the field be read only that gets filled with the user's name when the form loads. I couldn't get your javascript to function correctly on that field.
You have to uncheck the 'readonly' on the field itself as well.
I fixed the problem by deleting the field and recreating it. Seems like a bug that should be fixed.
Rick,
I've tested and confirmed that it works without JavaScript.
The only time I've ever had to use JavaScript is to remove/reset the read-only attribute when changing a read-only field via JavaScript, and in most cases I still used the Layout's read-only setting.
The catch with using the Layout's read-only is that you have to remove both the "readonly" and "backend-readonly" attributes because the layout setting adds both of those instead of just readonly.