Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Forms Data provider the localhost headless-admin-user access
Steps to reproduce
Use liferay-ce-portal-7.4.3.79-ga79
-
Allow Access Local Network in System Settings > Data Provider
-
Add System Settings -> API Authentication -> Basic Auth Header : /api/,/xmlrpc,/o/*
-
System Settings -> API Authentication -> Portal Sessions : /api/json*,/api/jsonws*,/c/portal/json_service*,/o/*
-
Test http://localhost:8080/o/headless-admin-user/v1.0/my-user-account is working,
-
Create a new data provider named my-user-account
-
URL: http://localhost:8080/o/headless-admin-user/v1.0/my-user-account
-
Output name: path
$..name
and type: Text, Label; name
-
-
Create a new form Form
-
add a field Name of type Text
-
in the Autocomplete select From Data Provider
-
Choose a Data Provider:my-user-account and Choose an Output Parameter: name
-
-
Save the form
-
Publish the form
-
Go to the Form URL
Expected behavior
A Form will be prefilled by : Test Test, as it is in the json field: <name>Test Test</name>
Current behavior
2023-06-09 14:24:39.719 WARN [hystrix-DDMDataProviderInvokeCommandGroup-1][DDMRESTDataProvider:121] The data provider was not able to connect to the web service. Unable to transmit request to localhost
Nothig is prefilled.
PS.: I have created by mistake LPS-187170 as a copy of another similar issue. There are prefiled wrong labes and branches, I could not change.
Hi Petr, I can see a couple issues with this off the bat:
1. The JsonPath expressions $..name will return any element called name, including for the user's role names, site names, etc.. So you're actually getting a list from the data provider they way you have it configured. You can test this by pasting the response from the API explorer into the JsonPath evaluator here: https://jsonpath.com/. Using the expression $.name returns just the user's name.
2. Autocomplete is meant for use with a List return type. The user begins typing in the text field and a filtered list of options is shown as a drop-down. What you may actually want is to use an Autofill rule. See Using the Autofill Rule
Editing to add: I'm not sure it will actually work even if you try my suggestion. I know in the past there have been issues around autofilling using the form user's own user data, but I think your approach needs to be improved to find out if there's really a bug.
Powered by Liferay™