Skip to content

Instantly share code, notes, and snippets.

@drmmr763
Created January 5, 2013 02:12
Show Gist options
  • Save drmmr763/4459228 to your computer and use it in GitHub Desktop.
Save drmmr763/4459228 to your computer and use it in GitHub Desktop.
edit.php for a front end submit form using jform. the user id field isn't working.
<?php
/**
* @package Joomla25.Bizform
* @subpackage Components
* @author Chad Windnagle
* @link http://www.chadwindnagle.com
* @license License GNU General Public License version 2 or later
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// Load the tooltip behavior.
JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation');
JHtml::_('behavior.keepalive');
JHtml::_('formbehavior.chosen', 'select');
?>
<script type="text/javascript">
Joomla.submitbutton = function(task) {
if (task == 'submit.cancel' || document.formvalidator.isValid(document.id('rootflick-submit-form'))) {
<?php echo $this->form->getField('description')->save(); ?>
Joomla.submitform(task, document.getElementById('rootflick-submit-form'));
} else {
alert('<?php echo $this->escape(JText::_('JGLOBAL_VALIDATION_FORM_FAILED'));?>');
}
}
</script>
<form action="<?php echo JRoute::_('index.php?option=com_rootflick&view=submit&layout=edit&id='.(int) $this->item->id); ?>"
method="post" name="adminForm" class="form-validate" id="rootflick-submit-form">
<div class="btn-toolbar">
<div class="btn-group">
<button type="button" class="btn btn-primary" onclick="Joomla.submitbutton('submit.save')">
<i class="icon-ok"></i> <?php echo JText::_('JSAVE') ?>
</button>
</div>
<div class="btn-group">
<button type="button" class="btn" onclick="Joomla.submitbutton('submit.cancel')">
<i class="icon-cancel"></i> <?php echo JText::_('JCANCEL') ?>
</button>
</div>
</div>
<fieldset class="adminform">
<ul class="adminformlist">
<?php foreach ($this->form->getFieldset() as $field): ?>
<li><?php echo $field->label; ?>
<?php echo $field->input; ?></li>
<?php endforeach ?>
</ul>
</fieldset>
<input type="hidden" name="jform[user_id]" id="jform_user_id" value="<?php echo JFactory::getUser()->id; ?>" />
<input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?>
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment