My form code is as below.
 
//Add a wrapper for the AHAH variables.
$form['work_history_wrapper'] = array(
'#title' => t("Work history: Mention all the companies you gave worked so far"),
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#prefix' => '<div class="clear-block" id="work-history-wrapper">',
'#suffix' => '</div>',
);
$form['work_history_wrapper']['company'] = array(
'#type' => 'textfield',
'#title' => t('Company'),
'#size' => 30,
'#maxlength' => 100,
);
$form['work_history_wrapper']['sdate'] = array(
'#type' => 'date',
'#title' => t('Start Date'),
);
$form['work_history_wrapper']['edate'] = array(
'#type' => 'date',
'#title' => t('End Date'),
);
 $form['work_history_wrapper']['morecompany'] = array(
'#type' => 'button',
'#value' => 'Add More Company...',
'#attributes' => array('onclick' => 'return false;'),
);
 
 
Please let me know,, how can I make use of AHAH, so that on clicking add  more company button, will add more rows.
 
Thanks

On Thu, Mar 10, 2011 at 3:16 PM, Austin Einter <austin.einter@gmail.com> wrote:
Thanks Steve.
I wanted to do it through custom module because of certain reasons.
I had three questions.
 
 1. How can I add 4 fields in one line. By default these are coming below of
 earlier field.
 2. How to make use of AHAH.
 3. Also one more challenge for me is how do act on "onClick" of "*Add More
 ...*" button, by default it may call submit handler.
 
Now I have resolved 1st issue through CSS rules.
 
Please give me input on 2nd and 3rd questions.

 
Thanks
 
On Thu, Mar 10, 2011 at 8:28 AM, Steve Kessler <skessler@denverdataman.com> wrote:

You can use the 3.x Alpha 1 of CCK. http://drupal.org/project/cck 

I used this on a site recently and it worked well. 

Thanks,

Steve 

Steve Kessler
Owner, DenverDataMan
(303) 587-4428

This email was sent from my Droid.

On Mar 9, 2011 7:39 PM, "Austin Einter" <austin.einter@gmail.com> wrote:
> Hi
> I am making a custom form, where I want to have work history of a person in
> one line and at the end of line a button "add more".
> It will look some thing like as below -
>
> *Company * *Start-Date* *End-Date* *Add More ...*
> **
> If user clicks on button "*Add More ...*" then it should add one more line
> and my form should look as below
>
> *Company * *Start-Date* *End-Date* *Add More ...*
> *Company * *Start-Date* *End-Date* *Add More ...*
>
> So how many times user clicks "*Add More ...*", those many rows should be
> shown up.
>
> How can I acheive it in Drupal. As per documentation and google search AHAH
> is capable of doing it.
> Please correct me if wrong.
>
> My custom form code is as below. My questions are -
>
> 1. How can I add 4 fields in one line. By default these are coming below of
> earlier field.
> 2. How to make use of AHAH.
> 3. Also one more challenge for me is how do act on "onClick" of "*Add More
> ...*" button, by default it may call submit handler.
>
> A step by step approach will help me, as first time I am looking at AHAH.
>
> Best Regards
> Austin

--
[ Drupal support list | http://lists.drupal.org/ ]