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

TOPIC:

How do you use get to update a field? 2 18 Jun 2015 11:31 #13281

Sorry to repost, maybe I didn't ask the right question or am just expected to work it out. Trust me I have given it a go. lots of goes.

Can someone please show the code for taking from the URL Actions the value of a variable called entered and fill the field called Incidentid on open.

?entered=1434618105&tmpl=component


Please trust me I have googled, searched and tried various combinations. I really need some help here. My PHP is very very very limited.

I'm assuming it goes somewhere in one of the two files below...

actionsitem.php
/**                               ______________________________________________
*                          o O   |                                              |
*                 (((((  o      <    Generated with 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		Jonathan Bell - www.saferecord.org - contact@mmb.co.nz
* @license		Commercial
*
*             .oooO  Oooo.
*             (   )  (   )
* -------------\ (----) /----------------------------------------------------------- +
*               \_)  (_/
*/

// no direct access
defined('_JEXEC') or die('Restricted access');


Safety101Helper::headerDeclarations();
//Load the formvalidator scripts requirements.
JDom::_('html.toolbar');
?>
<script language="javascript" type="text/javascript">
	//Secure the user navigation on the page, in order preserve datas.
	var holdForm = true;
	window.onbeforeunload = function closeIt(){	if (holdForm) return false;};
</script>

<?php
// Render the page title
echo JLayoutHelper::render('title', array(
	'params' => $this->params
)); ?>
<form action="<?php echo(JRoute::_("index.php")); ?>" method="post" name="adminForm" id="adminForm" class='form-validate' enctype='multipart/form-data'>
	<div>
		<div>
			<!-- BRICK : toolbar_sing -->

			<?php echo $this->renderToolbar();?>
		</div>
		<div>
			<!-- BRICK : form -->

			<?php echo $this->loadTemplate('form'); ?>
		</div>
	</div>


	<?php 
		$jinput = JFactory::getApplication()->input;
		echo JDom::_('html.form.footer', array(
		'dataObject' => $this->item,
		'values' => array(
					'id' => $this->state->get('actionsitem.id')
				)));
	?>
</form>

actionsitem_form.php
<?php
/**                               ______________________________________________
*                          o O   |                                              |
*                 (((((  o      <    Generated with 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		Jonathan Bell - www.saferecord.org - contact@mmb.co.nz
* @license		Commercial
*
*             .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
	// Incidentid
	$field = $fieldSet['jform_incidentid'];
	$field->jdomOptions = array(
		'list' => $this->lists['fk']['incidentid']
			);
	?>
	<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>
</fieldset>

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

Last edit: by jonathanbell. Reason: No one answered my post so changing!

How do you use get to update a field? 2 13 Jul 2015 09:05 #13331

Hi Jonathan,

Is the url from the frontend or backend?

Can you give a bit more context, because it is not clear what you need.
Getting the vars from a request is simple enough, but the right place is a bit harder.

Are the file you mention the view files?
The following user(s) said Thank You: jonathanbell

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

Last edit: by Romkabouter.

How do you use get to update a field? 2 18 Jul 2015 20:55 #13348

Hi Romkabouter, I've worked it out. The views where on the front end.

Chef pointed me in the right direction as my code I was using (being a novice) was a bit insecure.

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

  • Page:
  • 1
Time to create page: 0.058 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