views:

16

answers:

1

Hi, I have a form like poll form.When there is no data in db I want to show only add button and when user clicks "more" I want to show him/her a submit button. I used the following code but it seems doesn't works.

if ($form['count']['#value'] > 0) {
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit')
  );
}

How can I do this?

A: 

The values will be in $form_state['values'] so try:

if($form_state['values']['count'] > 0){....

I would expect that at this point the $form['count']['#value'] is not set.

hookd

related questions