Welcome, Guest
Username: Password: Remember me

TOPIC: Combo default value

Combo default value 28 Dec 2013 09:37 #11859

  • ewajoom
  • ewajoom's Avatar
  • Offline
  • Junior Member
  • Posts: 36
  • Thank you received: 2
  • Karma: 0
Hi,

Is it possible to set a default value in a combo for a new item ?
In the model, I've got :
$data->idcne = $jinput->get('filter_idcne', $this->getState('filter.idcne'), 'INT');

I've tested :
$data->idcne = 5;
thinking that the combo would take this id : no effect.

Some can help me ?

Thanks!
The administrator has disabled public write access.

Combo default value 29 Dec 2013 23:02 #11865

  • neoneper
  • neoneper's Avatar
  • Offline
  • Junior Member
  • Posts: 35
  • Thank you received: 2
  • Karma: 0
I also have interest in this question!
Complementing the doubt of the partner: And to open the form (NEW) with some fields already filled in?
I noticed that the form fields are generated here:
$this->item		= $item		= $this->get('Item'); 
$this->form		= $form		= $this->get('Form');

But I can not understand how I could modify it to deichar some fields already filled with values.

Please: SomeBody?
Last Edit: 29 Dec 2013 23:03 by neoneper.
The administrator has disabled public write access.

Combo default value 30 Dec 2013 13:40 #11869

  • admin
  • admin's Avatar
  • Online
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
@ewajoom.

Strange, It should work.
Does it work when you use the filter var in the url (original code)
...&filter_idcne=5

@neoneper
You can edit the item, and change the save button for 'save as copy'.
And the original item can be saved only for a specific ACL.
Put this ACL ($model->canSave($item))
- on the save button visibility
- AND in the save controller task.

Hope it helps
Coding is now a piece of cake
The administrator has disabled public write access.

Combo default value 30 Dec 2013 16:58 #11871

  • neoneper
  • neoneper's Avatar
  • Offline
  • Junior Member
  • Posts: 35
  • Thank you received: 2
  • Karma: 0
I do not know if this applies!!
In my case, I no have a form with values ​​to be edited!

Would be the new form to enter the first values in the table.
I own some fields such as:
Name, Address, ...

This form appears only for users who are already logged into the system joomla, so I wanted to be able to fill the (Name) field with the name of the user who are logged in, this way I will prevent the user having the name field different of the name User field who are logged!.
The administrator has disabled public write access.

Combo default value 02 Jan 2014 14:51 #11883

  • neoneper
  • neoneper's Avatar
  • Offline
  • Junior Member
  • Posts: 35
  • Thank you received: 2
  • Karma: 0
:pinch: Hii Cheff!
	$fieldSet = $this->form->getFieldset('newcandidatos.form'); //My New FORM
	$field = $fieldSet['jform_nome']; 
        echo $field->input;  //This print my InputText name. OK!

I managed to filter the information to catch only the input field which I wish!
In the example above I get the input field for name, in my new form. Its WORK GOOD.

Now I just wish to include a value to this field. This should work perfectly, see below!
	$fieldSet = $this->form->getFieldset('newcandidatos.form'); //My New FORM
	$field = $fieldSet['jform_nome']; 
       $field->value = 'change val test';  // Cannot access protected property JFormFieldCktext::$value (X.x)

The problem is that the variable (value) is a protected variable. She is not a public variable, so I can not modify this value! (T.T).
What could I do?
Last Edit: 02 Jan 2014 14:54 by neoneper.
The administrator has disabled public write access.

Combo default value 02 Jan 2014 19:01 #11886

  • admin
  • admin's Avatar
  • Online
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
Did you tried :
$field->set('value', 'change val test');

or
$field->setJdomOptions(array(
    'dataValue' => 'change val test'
));
...Not sure.

If not, fork :
classes/form/field.php
And access to the protected var.

Hope it helps.
Coding is now a piece of cake
The administrator has disabled public write access.

Combo default value 03 Jan 2014 13:10 #11894

  • neoneper
  • neoneper's Avatar
  • Offline
  • Junior Member
  • Posts: 35
  • Thank you received: 2
  • Karma: 0
Thank you Chef.
The options work fine. It is very rewarding to me because clarified me many other questions!
The administrator has disabled public write access.

Combo default value 03 Jan 2014 13:12 #11895

  • admin
  • admin's Avatar
  • Online
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
You are welcome.
Coding is now a piece of cake
The administrator has disabled public write access.

Combo default value 03 Jan 2014 13:33 #11896

  • neoneper
  • neoneper's Avatar
  • Offline
  • Junior Member
  • Posts: 35
  • Thank you received: 2
  • Karma: 0
Is there any LINK where I can see more details about the options that I can use in jdom Options?
I see it it possesses a plethora of options, but as I do not know, I'm giving work for you here in the forum. I searched on google but can not find anything about it!
The administrator has disabled public write access.

Combo default value 03 Jan 2014 13:43 #11898

  • admin
  • admin's Avatar
  • Online
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
The options varies with the JDom class.

To know them, you must open the JDom classes, and see the received parameters.
The classes herit from parent, so you need to check in parent files.

JDom documentation is missing.
Coding is now a piece of cake
The administrator has disabled public write access.

Combo default value 03 Jan 2014 13:59 #11899

  • neoneper
  • neoneper's Avatar
  • Offline
  • Junior Member
  • Posts: 35
  • Thank you received: 2
  • Karma: 0
I found what I was looking for!.
Can I check the parameters and functions through use of the library included in the project!

../libraries/jdom/html/form (...)

Tankx Brother!
The administrator has disabled public write access.
Time to create page: 0.188 seconds

Get Started