/[drupal]/contributions/modules/signup/js/signup_edit_form.js
ViewVC logotype

Contents of /contributions/modules/signup/js/signup_edit_form.js

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.4 - (show annotations) (download) (as text)
Sun Sep 20 22:25:50 2009 UTC (2 months, 1 week ago) by dww
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +2 -2 lines
File MIME type: text/javascript
#539052 by dww: Fixed jQuery bug when users edited their signups that
was causing most of the form elements to be enabled before pressing
the 'Edit' button (all form elements should be disabled at first).
1 /* $Id: signup_edit_form.js,v 1.3 2009/08/03 19:58:11 dww Exp $ */
2
3 /**
4 * On the signup edit form, add some bling to make users "confirm" the edit.
5 *
6 * When the form first loads, all the form elements are disabled
7 * except for the 'Update signup' button. When a user clicks that,
8 * the other form elements are enabled, and the 'Update signup' button
9 * text changes into 'Save changes'.
10 */
11 Drupal.behaviors.enableSignupEditForm = function(context) {
12 if (!Drupal.settings.signupEditFormErrors) {
13 var $button = $('#edit-save', context).click(enableSave);
14 var $form = $button.parents('form:first');
15 var $form_elements = $form.find(':visible');
16 var original_button_title = $button.val();
17
18 $form_elements.attr('disabled', 'disabled');
19 $button.attr('disabled', '').val(Drupal.t('Edit'));
20 }
21
22 function enableSave() {
23 $form_elements.attr('disabled', '');
24 $button.unbind('click', enableSave).val(original_button_title);
25 return false;
26 }
27 }
28

  ViewVC Help
Powered by ViewVC 1.1.2