Welcome, Guest
Username: Password: Remember me

TOPIC: How do you use get to update a field? 2

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

  • jonathanbell
  • jonathanbell's Avatar
  • Offline
  • Premium Member
  • Posts: 147
  • Thank you received: 5
  • Karma: 1
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>
Last Edit: 19 Jun 2015 08:21 by jonathanbell. Reason: No one answered my post so changing!
The administrator has disabled public write access.

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

  • Romkabouter
  • Romkabouter's Avatar
  • Offline
  • Elite Member
  • Posts: 310
  • Thank you received: 131
  • Karma: 48
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?
Last Edit: 13 Jul 2015 09:13 by Romkabouter.
The administrator has disabled public write access.
The following user(s) said Thank You: jonathanbell

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

  • jonathanbell
  • jonathanbell's Avatar
  • Offline
  • Premium Member
  • Posts: 147
  • Thank you received: 5
  • Karma: 1
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.
The administrator has disabled public write access.
Time to create page: 0.088 seconds

Get Started