Hello,

This is a problem we are facing while trying to populate a read-only field using URL parameters. When we set the value of the read-only field using the Hash Variables defined for accessing the URL parameters, #requestParam.keyName#, the value is displayed in the form, but it does not get saved to the database on submit of form. Which is why when this form is used as a sub-form inside any other form, the value for that particular field is blank..

In other way when we use any non-read-only field to fetch the values from the URL parameters using the Hash Variables, this value gets saved in the database on form submission.

We are not sure whether it is bug or not. Or may be there is some other way to populate a read-only field through the URL parameters and also save the same in the database when the form is submitted?

Kindly help.

Thanks and Regards,

Ashutosh Tripathi

  • No labels

5 Comments

  1. Hi Ashu,

    This is an expected behaviour as when the form is in read only mode, there's no logical reason to save the form data.

    You may try to use a hidden field instead. Make sure that you tweak the settings accordingly so that the value you set will get the precedence to be saved first.

    Good luck!

    1. Hi Hugo,

      Yes, this is expected behavior that if a form is read only then no reason to save the form data to database. But here the problem is different. The form is not read only instead only one field is read only which we are populated by a URL parameter and rest are normal field. When we save the form then all values except the read only field is saved.

      However, when we set the default value to the read only field then it is saved to the database

      Suppose we want a user to fill a form and there are few fields which are non editable and pre-populated (By URL parameters) . But all values need to be saved in the database. Then how can we achieve this? 

      Regards,

      Promod

      1. Hi Promod,

        Thanks. Let me try to replicate your said behaviour.

        Quick check, for the field that you prepopulated with that hash variable, what form field element is that? Text field, hidden field or something else?

        Cheers.

        1. Hi Hugo,

          Thanks for the quick response. The field that we want to be shown as read-only and whose value we want to populate through the URL parameters is a text-field.

          And just to make things clear, we want to show this form (containing this read-only text field) as a sub-form in some other form.

          We would very much appreciate your help.

          Thanks and Regards,

          Ashutosh Tripathi

          1. Hi Ashu,

            You will need to use a hidden field instead of text field. It's the same reason I stated above, as it is a read only field, value set will not be saved.

            Anyway, you should think of other alternative if you want the value set to be non-editable as you are setting via URL parameters which is not fool-proof after all.

            Hope this helps.

            Cheers.