Ajax Generated Form Element's Updated Value Is Not Passed On Submit

I have a dropdown select box and a textarea. I want to update the textarea each time I change the value of the dropdown select box. The value of the textarea will come from the database and will depend on the value of the dropdown select. I was able to update the textarea each time the select box is changed. However, when I add something to the value in the textarea or change it to something, I still get the same value when it was changed onselect when I submit the form:


<?php

function mymodule_form_builder($form, $form_state) {
$form = array();
$form['term'] = array(
'#title' => t("Choose a term"),
'#type' => 'select',
'#options' => array(
'one' => 'Option 1',
'two' => 'Option 2',
'three' => 'Option 3'
),
'#ajax' => array(
'callback' => 'mycallback',
'wrapper' => 'textarea-div',
),
);

$form['mytextarea'] = array(
'#title' => t('Keywords For This Term'),
'#type' => 'textarea',
'#prefix' => '

',
'#suffix' => '

'
);

if (!empty($form_state['values']['term'])) {
$form['mytextarea']['#value'] = datafromdatabase($form_state['values']['term']);
}

$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);

return $form;
}

function mycallback($form, $form_state) {

Form #action and url parameters

Hi,

I've got a page which displays a form. This page can be accessed with and without query parameters (like ?mode=1). Now, since this is a search form, the same page is loaded each time the user pressed 'Search' (submit button) - with search results being the only addition to the page.

Change the size of subject field in comments form

The title says all. I am converting a theme(http://drupal.org/project/CristalX4Drupal) to drupal 7, but the field subject in the comments form is too big, so i need change the "size" attribute, can you give me a sample how i can change it?
I tried:

Need to pick your brain

One of the great blessings of Drupal is that there is more than one way to accomplish just about everything...and it's also a curse of confusion. With so many options I'd appreciate knowing how you would approach the problem.

THE EASY PART
1) It's for a directory site where users can list their services for free.
2) The list is sorted by oldest date first.
3) Only one ad per user allowed.
4) The free ad expires after 90 days.
5) An email is sent to the 'free ad' poster notifying them when their ad expires.

How do you change the color of a nice_menu menu button?

Hi,

I was asked to help edit a site and I'm entirely confused on how to do it. I work with Dreamweaver, and it's just about the only program I have experience with. Drupal appears entirely different. This editing job, which would only take a few minutes in Dreamweaver is seeming impossible now. The site was created in Drupal and I can't even properly find the html documents to attempt to edit.

Pages

Subscribe with RSS Subscribe to RSS - Drupal 7.x