original:
<div id="edit-scheme-wrapper" class="form-item">
<label for="edit-scheme">Color set: </label>
<select id="edit-scheme" class="form-select" name="scheme">
</select>
</div>
<?php
$form['schemedelete'] =
array(
'#type' => 'submit',
'path' => 'color/js',
'wrapper' => 'edit-scheme-wrapper',
'method' => 'replace'
),
)?>
AHAH replace does this:
<div id="edit-scheme-wrapper" class="form-item">
<div>
<div id="edit-scheme-wrapper" class="form-item">
<label for="edit-scheme">Color set: </label>
<select id="edit-scheme" class="form-select" name="scheme">
</select>
</div>
</div>
</div>
<?php
function color_js() {
//drupal_add_js('if (Drupal.jsEnabled) { $(document).ready(function() { $("#edit-poll-more").val("'. t('Add another choice') .'"); }); }', 'inline');
$theme = "skiquel";
$info = color_get_theme_info($theme);
// Add palette fields
// See if we're using a predefined scheme
if ($scheme = color_get_scheme('theme', $theme, 'hex')) {
$current_array =
explode(',',
$current);
}
// $node = (object)$_POST;
$form_state =
array('submitted' =>
FALSE);
$form_build_id = $_POST['form_build_id'];
// Add the new element to the stored form. Without adding the element to the
// form, Drupal is not aware of this new elements existence and will not
// process it. We retreive the cached form, add the element, and resave.
//$form = form_get_cache($form_build_id, $form_state);
$info['schemes']['Custom'] = '';
'#post'=> $_POST,
'#programmed' => FALSE);
'#type' => 'select',
'#title' =>
t('Color set'),
'#default_value' => $current,
'#tree' => FALSE,
'#description' => " <a href=\"#\" id=\"delscheme\">" . t('Delete') . "</a> | <a href=\"#\" id=\"addscheme\">". t('Add') . "</a>",
);
// We send the updated file attachments form.
// Don't call drupal_json(). ahah.js uses an iframe and
// the header output by drupal_json() causes problems in some browsers.
}?>