Skip to content

HtmlRenderer: submit type for create and edit action buttons#41

Open
titus-toia wants to merge 1 commit into
mainfrom
fix/create-button-submit
Open

HtmlRenderer: submit type for create and edit action buttons#41
titus-toia wants to merge 1 commit into
mainfrom
fix/create-button-submit

Conversation

@titus-toia
Copy link
Copy Markdown

Bug

HtmlRenderer::render_action() sets type="submit" only for the save action; create and edit fall through to type="button". A type=button button submits nothing, so any form rendered by HtmlRenderer whose action is create/edit is a dead button — clicking it does nothing (no POST, no navigation, no network request).

Concretely: the DataView "Add New" create form can't create anything — Create is a dead button. (The TangibleFieldsRenderer already maps create/save to submit; only HtmlRenderer was missing it.)

Fix

- $type = ( $action === 'save' ) ? 'submit' : 'button';
+ $type = in_array( $action, [ 'save', 'create', 'edit' ], true ) ? 'submit' : 'button';

route_plural() already handles the create/edit POST submissions, so this just lets the buttons actually post. Purely additive: save unchanged, custom JS actions stay button.

delete is intentionally left as button — this renderer adds no confirm onclick, so making it a bare submit would be a no-confirm delete. Deletion is handled via list-view links.

The action buttons rendered by HtmlRenderer only set type=submit for
'save'; 'create' and 'edit' fell through to type=button, so their forms
never posted (e.g. the DataView 'Add New' create form was a dead button).
route_plural already handles their POST submissions. Delete is left as a
button since this renderer adds no confirm handler.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants