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

The j-cook project is one of the best of its kind and it is nice that we all try to contribute in little ways to make life easy for each other.

vlemos (Forum)  

Get Started