ricslabb03
Member
Hi,
I have a calc field in a repeated group (quote_items) that returns an html submit button:
(I didn't use a button plugin, because I need to pass the value "clicked" to the button.)
In this element I fire some element js:
This updates a field in the parent table quotes. I need to update quotes___repeat_counter for the following form onAfterProcess php plugin to work:
(You see why I needed to pass the "clicked" value into the button.) I basically used the quotes___repeat_counter value to get the id of the repeat group which I then needed to use to redirect to another location ie 'index.php/area-items?qiid='.$qiID.'&qid='.$qid.'&tmpl=component'.
The problem I'm having is that it seems as though it can either run the submit button html code or the element javascript, not both similtaneously. What's happening is that if I press the button for a saved repeat row it fires the submit, but not the element javascript and so redirects the page to the wrong list. However, when I create a new row in the form and press the button, the element javascript runs, but not the submit button's html script. (Btw, the element javascript works for an ordinary button what doesn't redirect.)
Thanks for your help
See screenshot below for my basic form layout.
I have a calc field in a repeated group (quote_items) that returns an html submit button:
PHP:
$button = '<button class="btn btn-success button save" name="edit_items" type="submit" value="clicked">Edit Area Items</button>';
return $button;
(I didn't use a button plugin, because I need to pass the value "clicked" to the button.)
In this element I fire some element js:
JavaScript:
var rnum = this.getRepeatNum();
var rc = Fabrik.getBlock('form_70').formElements.get('quotes___repeat_counter');
console.log(rnum);
rc.update(rnum);
This updates a field in the parent table quotes. I need to update quotes___repeat_counter for the following form onAfterProcess php plugin to work:
PHP:
$rnum = $formModel->getElementData('quotes___repeat_counter');
$qid = $formModel->getElementData('quotes___id');
$qiID = $formModel->getElementData('quote_items___id', false, '0', $rnum);
// make sure main submit buttons aren't affected
$app =& JFactory::getApplication();
$clicked = isset($_POST['edit_items']) ? $_POST['edit_items'] : '' ;
if( $clicked == 'clicked' ) {
$app->redirect(JRoute::_(JURI::root().'index.php/area-items?qiid='.$qiID.'&qid='.$qid.'&tmpl=component', false));
}
(You see why I needed to pass the "clicked" value into the button.) I basically used the quotes___repeat_counter value to get the id of the repeat group which I then needed to use to redirect to another location ie 'index.php/area-items?qiid='.$qiID.'&qid='.$qid.'&tmpl=component'.
The problem I'm having is that it seems as though it can either run the submit button html code or the element javascript, not both similtaneously. What's happening is that if I press the button for a saved repeat row it fires the submit, but not the element javascript and so redirects the page to the wrong list. However, when I create a new row in the form and press the button, the element javascript runs, but not the submit button's html script. (Btw, the element javascript works for an ordinary button what doesn't redirect.)
Thanks for your help
See screenshot below for my basic form layout.