Yii Framework Forum: Howto Set A Default Value For An Input Field In Member List - Yii Framework Forum

Jump to content

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

Howto Set A Default Value For An Input Field In Member List Rate Topic: -----

#1 User is offline   reburg 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 84
  • Joined: 15-January 13

Posted 04 September 2013 - 02:50 PM

Hi,
I use the extension multimodelform.

I have a dropdown list in the member list of the form. The selected value of the last row should be copied when creating a new row. In other words: The last selected value should get the default value for this data field.

I realized that there is a hidden row in the multiModelForm member table. All data fields in this hidden template have an empty value and if it is a dropdown list, there is no value selected.

How can I set a default value to one or more template input fields?
Greetings from Austria
Ferdinand
0

#2 User is offline   Joblo 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 682
  • Joined: 12-September 10
  • Location:Austria

Posted 11 September 2013 - 03:02 AM

You can set the option 'clearInputs' (default=true) of the js-plugin.
If false, the new row will keep the values of the cloned row (=the last in the list)

This should work:

$this->widget('ext.multimodelform.MultiModelForm',array(
       'options'=>array('clearInputs'=>false),
       .....   

    ));


0

#3 User is offline   reburg 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 84
  • Joined: 15-January 13

Posted 11 September 2013 - 03:03 PM

View PostJoblo, on 11 September 2013 - 03:02 AM, said:

...
This should work:
$this->widget('ext.multimodelform.MultiModelForm',array(
       'options'=>array('clearInputs'=>false),
       .....   

    ));


Ok, this option only works for me with text input fields. If the input field is a dropdownlist it does not keep ( = copy) the selected item in this list. Can you help me to manage this?

Many thanks in advance.
Ferdinand
Greetings from Austria
Ferdinand
0

#4 User is offline   reburg 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 84
  • Joined: 15-January 13

Posted 25 September 2013 - 02:53 PM

View Postreburg, on 11 September 2013 - 03:03 PM, said:

Ok, this option only works for me with text input fields. If the input field is a dropdownlist it does not keep ( = copy) the selected item in this list.

Since version 5.0 of the extension multimodelform it works. If the option
'clearInputs'=>false
is set, then the selected value of a dropdownlist is copied into the new row.
Greetings from Austria
Ferdinand
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