| 1 |
// $Id$
|
| 2 |
/**
|
| 3 |
* Required jQuery methods to enable ahah processing of decisions forms
|
| 4 |
*
|
| 5 |
**/
|
| 6 |
|
| 7 |
/**
|
| 8 |
* jQuery callback to be executed after user requests Drupal to add a new choice using ahah.
|
| 9 |
*
|
| 10 |
* @param context content to insert
|
| 11 |
*/
|
| 12 |
jQuery.fn.decisions_addChoice = function(context){
|
| 13 |
|
| 14 |
var choices = jQuery('#edit-choice-choices');
|
| 15 |
var maxchoices = jQuery('#edit-settings-maxchoices');
|
| 16 |
var count = parseInt(choices.attr('value')) + 1;
|
| 17 |
|
| 18 |
// Append newly received form element to list
|
| 19 |
this.before(context);
|
| 20 |
// Refresh choices count
|
| 21 |
choices.attr('value', count);
|
| 22 |
// Refresh maxchoices list to new count
|
| 23 |
maxchoices.append(
|
| 24 |
jQuery('<option></option>').val(count).html(count)
|
| 25 |
);
|
| 26 |
|
| 27 |
}
|
| 28 |
|