Closed paulkilla closed 8 years ago
I'm not able to recreate this. This needs to be tried on a modern browser without extensions running to verify.
Issue is caused by HTML browser form validation.
Produced on:
Telling me to fill in the hidden PostgreSQL on Firefox when clicking submit:
Just also tried to install govcms and had the same problem. Firefox on linux mint. As noted workaround was to just to fill in the postgreSQL fields even though I am using MySQL.
Reopening this issue as it seems more widespread than first thought. From any of the affected users, is this govCMS specific or do you also experience this installing Drupal minimal/standard profiles.
The module https://www.drupal.org/project/accessible_forms adds in the HTML5 required attribute, this looks like the cause of the issue. Perhaps a simple solution is to make the the PostgreSQL fields not mandatory (through hook_form_FORMID_alter).
Would this module be active during site install? Does Drupal boot all modules prior to anything being installed? If that's the case we should probably also decide whether this is a module bug.
You see the red "(mandatory)" in the screenshot - I believe the module accessible_forms does this.
In themes/govcms/govcms_zen/template.php line #205 it has:
$variables['element']['#attributes']['required'] = 'true';
Which adds the required="true" attribute
All browsers except Safari will respect this attribute to prevent the from from submitting
A simple fix could be in install.js, add:
for(var f=document.forms,i=f.length;i--;)f[i].setAttribute("novalidate",i)
Which will only disable browser's form validation during installation. All other form validations after installation are not affected.
Should we also consider a template.php option instead of js?
/**
* Adds accessibility attributes.
*/
function govcms_zen_preprocess_aria_invalid(&$variables) {
if (!empty($variables['element']['#required']) && !drupal_installation_attempted()) {
$variables['element']['#attributes']['required'] = 'true';
}
if (isset($variables['element']['#parents']) && form_get_error($variables['element']) !== NULL && !empty($variables['element']['#validated'])) {
$variables['element']['#attributes']['aria-invalid'] = 'true';
}
}
The reason I was not able to replicate this before was because I do not have php pgsql drivers. When I remove the autofilled field from the SQLite settings, then attempt to proceed with MySQL settings only I see the issue.
The issue is not observed when commenting out line 205 in template.php of govcms_zen (thanks @jozhao)
Do we have an agreed approach to this? Either the addition in the code @typhonius posted above, or commenting out/removing the line?
Is this still a thing, lads?
My 2 cents
@typhonius Please commit your solution ASAP :+1:
Can someone test #92 ?
Posted by tomz0r on July 14, 2015 at 4:13pm
/install.php?profile=govcms&locale=en
Having required="true" on the hidden form input fields is preventing the form from submitting. When you select MySQL as your database and fill in all the visible required fields, you also have to fill in dummy data in the PostgreSQL fields as well to be able to continue to the next step.