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

I jumped and started to work on a demo component... but 2 days later this demo component became the real component. I just showed today the end result to my customer and he turned to me and said... "this is more than I expected"... All of this is because Cook did cut about 70% of my work and provided me more ways to improve the usability of the component. The end result was 17 tables all related between than to generate a full dashboard for the travel agents. Thanks for Cook developers for such great tool. This component would not be possible to be done at short time with all the features in it
Griiettner (Forum)  

Get Started