Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

default value for a select box 19 Oct 2012 08:31 #4665

When you use a select box, just in the view.html.php

$model_partner_origin_id = JModel::getInstance('Partners', 'SamplestrackingModel');
$model_partner_origin_id->addGroupBy("a.acronym");
$lists = $model_partner_origin_id->getItems();

as in the default_form.php

<?php
// Partner Origin
$field = $fieldSet;
$field->jdomOptions = array(
'list' => $this->lists
);
?>
<dt><?php echo $field->label; ?></dt>
<dd><?php echo $field->input; ?></dd>

exist any way to declare a default selected index ?
Not in the xml file !!

Please Log in or Create an account to join the conversation.

Re: default value for a select box 19 Oct 2012 11:21 #4674

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Do you want to preffil the value, or a simple fallback ?

To set up a fall back, do it in the store() function of your table.
If you want to prefill a value, do it in prepareTable() in the item model, if I remember well.

You can try to set up a default value in the property box and check or not the prefill property. It is not possible for a FK, so try on a string field, and see how it works.
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.054 seconds

Let me first state that this is an amazing and fascinating product exactly what I was looking for. In just a few hours (listening to the very well made and clearly understandable videos learning doing) I completed and installed my first component. I am now in the second refining phase. I will make a recommenation in JED. Thanks for the effort in creating such a great product. Incidentally some of the best Joomla extension I use are of French origin !
Giori (Forum)

Get Started