1) Am i missing something here? it’s not replacing the textfield value.
2) Also how do i replace if i have a multiple textfield and multiple button in a form.
<?php function test($form, &$form_state) { if (isset($form_state['values']['your_name'])) { $name_value = $form_state['values']['your_name']; } else { $name_value = ""; } $form = array(); $form['your_name'] = array( '#title' => t('Your or your company name'), '#type' => 'textfield', '#value' => $name_value, '#prefix' => '<div id ="subscribers-name">', '#suffix' => '</div>', ); $form['load_settings'] = array( '#type' => 'button', '#value' => t('Load my settings'), '#ajax' => array( 'wrapper' => 'subscribers-name', 'callback' => 'simplenews_mod_load_subscriptions_ajax', 'method' => 'replace', ) ); return $form; } function simplenews_mod_load_subscriptions_ajax($form, &$form_state) { $form_state['values']['your_name'] = "loaded value"; return $form['your_name']; }