Problem/Motivation
Webform elements without any access '#access': false are always added to the (GET) request of the Webform 'remote_post' handler. This could possibly lead to an invalid request.
Steps to reproduce
- Create a Webform and add some regular elements and some elements without access
'#access': false - Add a remote_post handler to execute a (GET) request
- Note: elements without access are not shown in the 'excluded_data' settings of the handler and thus cannot be selected for exclusion.
- Submit the Webform and inspect the request that has been sent.
Proposed resolution
- Allow elements without access to be selected in the 'excluded_data' configuration by including them in the configuration form. The 'excluded_data' only provides elements with the 'view' operation as an option to be selected ($webform->getElementsInitializedFlattenedAndHasValue('view')).
- Add a new option to '(always) Exclude fields without access'. Add a checkbox to the configuration of the handler. If checked, always exclude all elements without access from the request data.
I'm aware that excluding all elements without access may not be the best option as they are sometimes useful to be forwarded to the endpoint.
Remaining tasks
Share your opinion on this issue.
User interface changes
Possibly an extra field (checkbox) in the configuration of the 'remote_post' Webform handler.
Issue fork webform-3449549
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
arno_vghComment #6
jrockowitz commentedThe feature request/access check makes sense but we will need to add tests and improve the approach.
For example, I think the new settings should called 'check_access' at it should only check for
#access: false.The concept of support #access: false is to allow admin to suppress elements without losing any data.
Comment #7
jrockowitz commentedComment #8
jrockowitz commentedComment #9
jrockowitz commentedIf the tests pass, I think this is RTBC
Comment #10
jrockowitz commentedComment #12
jrockowitz commentedMoving to RTBC as long as tests pass
Comment #14
jrockowitz commented