erp5_web_renderjs_ui: do not display submit and cancel if action is empty in form_dialog.
this is useful for an intermadiate dialog that does not require submit button but still top 'cancel' link works.
-
Owner
@kazuhiko @romain we have some report dialogs where the report is rendered directly in the dialog, like the new stock browser.
It looks like this:
In such dialogs, there is an action because action is required on dialogs, so we have an action that in reality is semantically an "Update" button.
Now with these changes, I understand this commit correctly, action is longer required on dialogs. So I was thinking of using this, to configure this dialog to have only an update action, then it would look like this:
I think it makes more sense, because it's a dialog where user change parameters, click "update" to see the new result, but can never click "Action" to "Do the action", because there's no action in reality.
Problem is that this does not work :) clicking the button cause an
Cannot set property 'disabled' of null
error raised here.I think that's a bug, that can be fixed with something like this:
--- a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.js +++ b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.js @@ -25,13 +25,17 @@ gadget.element.querySelector('.dialog_button_container'), update_button = button_container.querySelector('button'), submit_input = button_container.querySelector('input'); - submit_input.disabled = true; + if (submit_input !== null) { + submit_input.disabled = true; + } if (update_button !== null) { update_button.disabled = true; } function enableButton() { - submit_input.disabled = false; + if (submit_input !== null) { + submit_input.disabled = false; + } if (update_button !== null) { update_button.disabled = false; }
is this something we want to support ?
/cc @tb
-
mentioned in merge request !1179 (merged)
-
Owner
+1
-
Owner
Thanks for feedback I'm trying to do this now.
-
Owner
BTW, why this was not implemented for erp5_xhtml_style ?
-
Owner
For stock browser I think I need xhtml_style support, so I will also implement it
-
mentioned in merge request !1181 (merged)