joomla - How to use Get to update php field -
i found. html - how pre-populate form field known value upon load?
and tried apply learnt from;
<input autocomplete='off' class='logininput' tabindex='3' type="text" name="company" id="company" value="<?php echo $_get["entered"]; ?>" maxlength='50' size="25">
to following piece of code ( j-cook component constructing )
<?php // incident $field = $fieldset['jform_incident'] ; ?> <div class="control-group <?php echo 'field-' . $field->id . $field->responsive; ?>"> <div class="control-label"> <?php echo $field->label; ?> </div> <div class="controls"> <?php echo $field->input; ?>
assuming code different example above tried number of ways make form auto fill
<?php echo $field->input; ?>
with out luck. appreciate if me this. lost now?? :(
thanks
here's whole page updated code provided far..
<?php /** ______________________________________________ * o o | | * ((((( o < generated cook self service v2.7 | * ( o o ) |______________________________________________| * --------oooo-----(_)-----oooo---------------------------------- www.j-cook.pro --- + * @version 1.02 * @package safety 101 * @subpackage incident actions * @copyright 2014 jonathan bell * @author jb * @license * * .oooo oooo. * ( ) ( ) * -------------\ (----) /----------------------------------------------------------- + * \_) (_/ */ // no direct access defined('_jexec') or die('restricted access'); if (!$this->form) return; $fieldsets = $this->form->getfieldsets(); ?> <?php $fieldset = $this->form->getfieldset('actionsitem.form');?> <fieldset class="fieldsform form-horizontal"> <?php // person responsible $field = $fieldset['jform_person_responsible']; $field->jdomoptions = array( 'list' => $this->lists['fk']['person_responsible'] ); ?> <div class="control-group <?php echo 'field-' . $field->id . $field->responsive; ?>"> <div class="control-label"> <?php echo $field->label; ?> </div> <div class="controls"> <?php echo $field->input; ?> </div> </div> <?php // date due $field = $fieldset['jform_action_due_date']; ?> <div class="control-group <?php echo 'field-' . $field->id . $field->responsive; ?>"> <div class="control-label"> <?php echo $field->label; ?> </div> <div class="controls"> <?php echo $field->input; ?> </div> </div> <?php // short description $field = $fieldset['jform_action_title']; ?> <div class="control-group <?php echo 'field-' . $field->id . $field->responsive; ?>"> <div class="control-label"> <?php echo $field->label; ?> </div> <div class="controls"> <?php echo $field->input; ?> </div> </div> <?php // full description $field = $fieldset['jform_full_description']; ?> <div class="control-group <?php echo 'field-' . $field->id . $field->responsive; ?>"> <div class="control-label"> <?php echo $field->label; ?> </div> <div class="controls"> <?php echo $field->input; ?> </div> </div> <?php // completed date $field = $fieldset['jform_action_completed_date']; ?> <div class="control-group <?php echo 'field-' . $field->id . $field->responsive; ?>"> <div class="control-label"> <?php echo $field->label; ?> </div> <div class="controls"> <?php echo $field->input; ?> </div> </div> <?php // action completed $field = $fieldset['jform_completed_yn']; ?> <div class="control-group <?php echo 'field-' . $field->id . $field->responsive; ?>"> <div class="control-label"> <?php echo $field->label; ?> </div> <div class="controls"> <?php echo $field->input; ?> </div> </div> <?php // incident $field = $fieldset['jform_incident'] ; ?> <div class="control-group <?php echo 'field-' . $field->id . $field->responsive; ?>"> <div class="control-label"> <?php echo $field->label; ?> </div> <div class="controls"> <?php $current_field = $field->input; $current_field_input = str_replace('/>', '', $current_field); $current_field_input = str_replace('>', '', $current_field); ?> <?php echo $current_field_input; ?> autocomplete='off' value="<?php echo (isset($_get["entered"])) ? $_get["enter"] : ""; ?>"/> </div> </div> </fieldset>
jformfield classes have preset , default options built in (these different, default saves if field left blank) can set in xml (file or string) form. api let change attributes of form or add new attributes. if use api whole code easier write , read. take @ examples in core cms , see many examples. few typical examples below showing add, set , get:
$fieldset->addattribute('description', 'com_categories_item_associations_fieldset_desc'); $field->addattribute('edit', 'true'); $form->setfieldattribute('ordering', 'disabled', 'true'); $fieldname = $field->getattribute('name');
Comments
Post a Comment