Commit c2eeb5cc authored by Nigel McNie's avatar Nigel McNie
Browse files

Ensure that when an error occurs on the profile form, the fieldset it occurs...

Ensure that when an error occurs on the profile form, the fieldset it occurs in doesn't get shown below the actual tabbed interface.

This problem happens because pieforms refuses to collapse fieldsets with errors in them (rightly, so people can see their mistakes).

The fix _might_ break some stuff, like specifying which tab to show on page load.
parent 3fa0a192
......@@ -123,29 +123,25 @@ $elements = array(
'profile' => array(
'type' => 'fieldset',
'legend' => get_string('aboutme', 'artefact.internal'),
'collapsible' => true,
'collapsed' => $fieldset != 'aboutme',
'class' => $fieldset != 'aboutme' ? 'collapsed' : '',
'elements' => get_desired_fields(&$items, array('firstname', 'lastname', 'studentid', 'preferredname', 'introduction'), 'about'),
),
'contact' => array(
'type' => 'fieldset',
'legend' => get_string('contact', 'artefact.internal'),
'collapsible' => true,
'collapsed' => $fieldset != 'contact',
'class' => $fieldset != 'contact' ? 'collapsed' : '',
'elements' => get_desired_fields(&$items, array('email', 'officialwebsite', 'personalwebsite', 'blogaddress', 'address', 'town', 'city', 'country', 'homenumber', 'businessnumber', 'mobilenumber', 'faxnumber'), 'contact'),
),
'messaging' => array(
'type' => 'fieldset',
'legend' => get_string('messaging', 'artefact.internal'),
'collapsible' => true,
'collapsed' => $fieldset != 'messaging',
'class' => $fieldset != 'messaging' ? 'collapsed' : '',
'elements' => get_desired_fields(&$items, array('icqnumber', 'msnnumber', 'aimscreenname', 'yahoochat', 'skypeusername', 'jabberusername'), 'messaging'),
),
'general' => array(
'type' => 'fieldset',
'legend' => get_string('general', 'artefact.internal'),
'collapsible' => true,
'collapsed' => $fieldset != 'general',
'class' => $fieldset != 'general' ? 'collapsed' : '',
'elements' => $items
),
'submit' => array(
......
......@@ -7,10 +7,9 @@ addLoadEvent(function() {
var tabs = [];
forEach(legends, function(legend) {
var a = legend.firstChild;
var a = A({'href': ''}, legend.firstChild);
legend.parentNode.tabLink = a;
a.id = legend.id + '_a';
disconnectAll(a);
connect(a, 'onclick', function(e) {
forEach(fieldsets, function(fieldset) {
if (fieldset == legend.parentNode) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment