cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to pre-populate the form field?

former_member614659
Participant
0 Kudos
1,491

Hello Experts,

I am working on lite-registration screen set.

We have populated email field of SAP CDC screen-set using js script at web page.

email is taken from URL of web page.

This logic, renders that email field of SAP CDC form is pre-populated as expected.

Email Field is read only.

Problem is when I submit the form, "formData" object doesn't collect email field value and system throws "missing required parameter " error(400002) for email field.

Please suggest if there is any best practice for pre-populating the data for lite user which holds his/her own data in URL or Body of https request

e.g. https://www.foo.com/lite?email=abc123@foo.com

Thanks,

Rohit

View Entire Topic
former_member614659
Participant
0 Kudos

kobico , Thanks for sharing.
we have already tried the approach but it seems workaround.
we also got the reason for issue. Its "read only" property set from UI builder restrict the submission of data. causing missing parameter error.

I don't have any idea if this bug or any thing else but when you check "read only" for any field, SAP CDC renders that input as "disabled" on form.

"read only" & "disabled" both attributes are responsible for restricting user from changing the input. but "disabled" attribute restricts the submission of data as well.

Please refere my next question.

kobico
Product and Topic Expert
Product and Topic Expert

Actually adding fields to onSubmit event (not onBeforeSubmit, my mistake) is not a workaround but the intended design for such use cases.

I do understand that in your use case you'd like to also *prepopulate* a field that doesn't exist on the user account data, this is not supported; so, your workaround that sets the input value directly seems inevitable.

So, for your use case, I think that it's OK to use both: setting it directly to the DOM and add it in the event to the form data.

0 Kudos

Hi kobico,

can you please elaborate more on how to add fields onSubmit event? Was trying to manipulate formModel there, but with no success.

Jarda