Skip to content

Commit d199eb9

Browse files
HtmlRenderer: submit type for create and edit action buttons (#41)
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. Co-authored-by: Titus TC <titus@teamtangible.com>
1 parent 9f82a11 commit d199eb9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/Renderer/HtmlRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ protected function render_sidebar( array $sidebar ): string {
189189
* @return string The rendered HTML.
190190
*/
191191
protected function render_action( string $action ): string {
192-
$type = ( $action === 'save' ) ? 'submit' : 'button';
192+
$type = in_array( $action, [ 'save', 'create', 'edit' ], true ) ? 'submit' : 'button';
193193
$label = ucfirst( $action );
194194

195195
return '<button type="' . $type . '" name="action" value="' . $this->escape( $action ) . '">' . $this->escape( $label ) . '</button>';

0 commit comments

Comments
 (0)