Yii Framework Forum: forms with "more" functionality - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

forms with "more" functionality Rate Topic: -----

#1 User is offline   schlydi 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 16-July 10

Posted 20 July 2010 - 03:27 PM

Hi,

I have a table 'tableA' which has several fields 'fieldA', 'fieldB', 'fieldC', 'fieldD'. The table also has the field 'tableBId', which references the field 'id' of the table 'tableB'. I have several table of this kind, all referencing tableB. Since I want the user to be able to fill out the forms in one page I tried making a form.php with
return array(
  'elements'=>array(
    'tablea'=>array(
      'type'=>'form',
      'title'=>'Form tableA',
      'elements'=>array(
        'fieldA'=>array(
          'type'=>'text',
          'label'=>'fieldA',
        ),
        'fieldB'=>array(
          'type'=>'text',
          'label'=>'fieldB',
        ),
        'fieldC'=>array(
          'type'=>'text',
          'label'=>'fieldC',
        ),
        'fieldD'=>array(
          'type'=>'text',
          'label'=>'fieldD',
        ),
      ), 
    ),

    'tablec'=>array(
      'type'=>'form',
      'title'=>'Form tableA',
      'elements'=>array(
        'fieldA'=>array(
          'type'=>'text',
          'label'=>'fieldA',
        ),
        'fieldB'=>array(
          'type'=>'text',
          'label'=>'fieldB',
        ),
        'fieldC'=>array(
          'type'=>'text',
          'label'=>'fieldC',
        ),
        'fieldD'=>array(
          'type'=>'text',
          'label'=>'fieldD',
        ),
      ), 
    ),
  ),
  
  'buttons'=>array(
    'register'=>array(
      'type'=>'submit',
      'label'=>'Register',
    ),
  ),
 );


My question is now: the user is allowed to have as many tableA-objects as he wants. Is it possible to add something like a 'more'-button? So that he gets a new form while the already filled in data is saved?

thanks,
schlydi
0

#2 User is offline   daonhack 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 34
  • Joined: 02-June 09

Posted 20 July 2010 - 04:01 PM

View Postschlydi, on 20 July 2010 - 03:27 PM, said:

Hi,

I have a table 'tableA' which has several fields 'fieldA', 'fieldB', 'fieldC', 'fieldD'. The table also has the field 'tableBId', which references the field 'id' of the table 'tableB'. I have several table of this kind, all referencing tableB. Since I want the user to be able to fill out the forms in one page I tried making a form.php with
return array(
  'elements'=>array(
    'tablea'=>array(
      'type'=>'form',
      'title'=>'Form tableA',
      'elements'=>array(
        'fieldA'=>array(
          'type'=>'text',
          'label'=>'fieldA',
        ),
        'fieldB'=>array(
          'type'=>'text',
          'label'=>'fieldB',
        ),
        'fieldC'=>array(
          'type'=>'text',
          'label'=>'fieldC',
        ),
        'fieldD'=>array(
          'type'=>'text',
          'label'=>'fieldD',
        ),
      ), 
    ),

    'tablec'=>array(
      'type'=>'form',
      'title'=>'Form tableA',
      'elements'=>array(
        'fieldA'=>array(
          'type'=>'text',
          'label'=>'fieldA',
        ),
        'fieldB'=>array(
          'type'=>'text',
          'label'=>'fieldB',
        ),
        'fieldC'=>array(
          'type'=>'text',
          'label'=>'fieldC',
        ),
        'fieldD'=>array(
          'type'=>'text',
          'label'=>'fieldD',
        ),
      ), 
    ),
  ),
  
  'buttons'=>array(
    'register'=>array(
      'type'=>'submit',
      'label'=>'Register',
    ),
  ),
 );


My question is now: the user is allowed to have as many tableA-objects as he wants. Is it possible to add something like a 'more'-button? So that he gets a new form while the already filled in data is saved?

thanks,
schlydi


You can implement relations() method in Model and then render out to form view via CActiveForm, so User can fill many A follow one B for example. When user submit all will be saved. Just an idea, hope that help.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users