Hi,

pressing the "Cancel" button in PmWiki version >=2.2.119 at, e.g.,
<https://www.pmwiki.org/wiki/PmWiki/ChangeLog?action=edit> requires to
fill the author field at first to continue.
That doesn't make sense to me.

Generated HTML code should be changed from:
  <input type='submit' name='cancel' value=' Cancel ' />
to:
  <input type='submit' name='cancel' value=' Cancel '
formnovalidate='formnovalidate' />
if "$EnablePostAuthorRequired = 1;".

Please find a proposed patch attached.
Notes:
1) A similar change worked for me in PmWiki 2.2.120. The patch attached
for 2.2.122 is untested, but should work.
2) Is the comma after 'aria-hidden' in the original file okay? In
2.2.120 there is no comma after the last value.
3) Maybe a similar patch is also required for "EnableUploadAuthorRequired".

Cheers,
Robert
-- 
              +++ BTTR Software +++
     Home page: https://www.bttr-software.de/
DOS ain't dead: https://www.bttr-software.de/forum/
--- forms.orig.php      Sun Nov 17 01:54:14 2019
+++ forms.php   Tue Nov 19 21:57:47 2019
@@ -13,10 +13,11 @@ SDV($InputAttrs, array('name', 'value', 
   'size', 'maxlength', 'action', 'method', 'accesskey', 'tabindex', 'multiple',
   'checked', 'disabled', 'readonly', 'enctype', 'src', 'alt', 'title', 'list',
   'required', 'placeholder', 'autocomplete', 'min', 'max', 'step', 'pattern',
   'role', 'aria-label', 'aria-labelledby', 'aria-describedby',
   'aria-expanded', 'aria-pressed', 'aria-current', 'aria-hidden',
+  'formnovalidate'
   ));
 
 # Set up formatting for text, submit, hidden, radio, etc. types
 foreach(array('text', 'submit', 'hidden', 'password', 'reset', 'file',
     'image', 'email', 'url', 'tel', 'number', 'search', 'date', 'button') as 
$t) 
@@ -403,12 +404,14 @@ SDVA($InputTags['e_cancelbutton'], array
   'name' => 'cancel', 'value' => ' '.XL('Cancel').' ' ));
 SDVA($InputTags['e_resetbutton'], array(
   ':html' => "<input type='reset' \$InputFormArgs />",
   'value' => ' '.XL('Reset').' '));
 
-if(IsEnabled($EnablePostAuthorRequired))
+if(IsEnabled($EnablePostAuthorRequired)) {
   $InputTags['e_author']['required'] = 'required';
+  $InputTags['e_cancelbutton']['formnovalidate'] = 'formnovalidate';
+}
 
 if(IsEnabled($EnableNotSavedWarning)) {
   $is_preview = @$_REQUEST['preview'] ? 'class="preview"' : '';
   $InputTags['e_form'][':html'] .=
     "<input type='hidden' id='EnableNotSavedWarning'
_______________________________________________
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users

Reply via email to