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.049 seconds

Although I found this tool some time ago I just started learning experimenting and building this first component on Monday and now on Thursday afternoon it's already online. Although I already had a working version done with another tool this is much easier to build and at the end you have the freedom to own your own component. Once you know how to use Cook you will boost your productivity as the learning curve is really moderate compared to many other tools.
Giori (Forum)

Get Started