Unable to submit rendered field I have a custom form with text field and a submit button.

$form['bid_amount'] = array(
  '#type' =&gt; 'textfield',
  '#title' =&gt; t("Your Bid"),
  '#prefix' =&gt; '&lt;div id="test-ajax"&gt;',
  '#suffix' =&gt; '&lt;/div&gt;',
);

$form['submit'] = array(
  '#type' =&gt; 'submit',
  '#value' =&gt; t('Calculate your bid'),
  "#ajax" =&gt; array(
  'callback' =&gt; 'custom_callback',
  'wrapper' =&gt; 'test-ajax',
  'method' =&gt; 'replace',
  'effect' =&gt; 'fade',
  ),
);
}


What I want to do is, when 'bid_amount' is empty, and button is clicekd, 'bid_amount' should be rendered again with a prefilled value.
This is what I can do.
But at this time, when again button is clicked, with FILLED field of 'bid_amount', it shows up again with suggested value. Actuly it should be submitted this time.

Here is how I am rendering this ....

function custom_callback(&amp;$form, &amp;$form_state) {

    $next_bid = 100;
    return array(
      '#type' =&gt; 'ajax',
      '#commands' =&gt; array(
        ajax_command_replace("#test-ajax", render($form['bid_amount'] = array(
              '#type' =&gt; 'textfield',
              '#title' =&gt; t("Your Bid"),
              '#value' =&gt; $next_bid,
              '#prefix' =&gt; '&lt;div id="test-ajax"&gt;',
              '#suffix' =&gt; '&lt;/div&gt;',
        ))),
      )
    );
}
I was facing the same issue.  I think the render function doesn't add "name" to the html so the form values are not submitted. I fixed this by adding them in the array

'#attributes' =&gt; array(
  'class' =&gt; array('edit-bid-amount'),
  'name' =&gt; 'bid_amount'
),


The function now is

function custom_callback(&amp;$form, &amp;$form_state) {
  $next_bid = 100;
  return array(
    '#type' =&gt; 'ajax',
    '#commands' =&gt; array(
      ajax_command_replace(
        "#test-ajax", render($form['bid_amount'] = array(
          '#type' =&gt; 'textfield',
          '#title' =&gt; t("Your Bid"),
          '#value' =&gt; $next_bid,
          '#prefix' =&gt; '&lt;div id="test-ajax"&gt;',
          '#attributes' =&gt; array(
            'class' =&gt; array('edit-bid-amount'),
            'name' =&gt; 'bid_amount'
          ),
          '#suffix' =&gt; '&lt;/div&gt;',
          )
        )
      ),
    )
  );
}


Hth,
Sadashiv