How do use get (or other methods) to retreive the value from the input?
views\learningobjectivepathway\view.html.php
The toolbar actions appear correctly and calls the action in the controller.
Code: Select all
JToolbarHelper::title($title, 'learningobjectivehaspathway');
JToolbarHelper::save('learningobjectivehaspathway.save');
JToolbarHelper::cancel('learningobjectivehaspathway.cancel', $isNew ? 'JTOOLBAR_CANCEL' : 'JTOOLBAR_CLOSE' );
JToolbarHelper::custom('learningobjectivehaspathway.wizardPrev', 'previous', 'previous', JText::_('COM_SCHEMEOFWORK_LEARNINGOBJECTIVEHASPATHWAY_WIZARD_PREV'), false);
JToolbarHelper::custom('learningobjectivehaspathway.wizardNext', 'next', 'next', JText::_('COM_SCHEMEOFWORK_LEARNINGOBJECTIVEHASPATHWAY_WIZARD_NEXT'), false);}
I want the value from the topic_id field.
Code: Select all
<fieldset
name="details"
label="COM_SCHEMEOFWORK_LEARNINGOBJECTIVEHASPATHWAY_DETAILS"
>
<field
name="id"
type="hidden"
/>
<field
name="topic_id"
type="Topics"
extension="com_schemeofwork"
class="inputbox"
default="0"
label="COM_SCHEMEOFWORK_LEARNINGOBJECTIVE_TOPIC_LABEL"
description="COM_SCHEMEOFWORK_LEARNINGOBJECTIVE_TOPIC_DESC"
required="true"
>
<option value="0">COM_SCHEMEOFWORK_LEARNINGOBJECTIVEHASPATHWAY_JOPTION_SELECT_TOPIC_NAME</option>
</field>
When using get I have tried $jinput->post->get and $jinput->get and for the variable name I have tried "topic_id", including "jform_topic_id" and "jform[topic_id]" as display in from id and form name from the html.
Code: Select all
class SchemeOfWorkControllerLearningObjectiveHasPathway extends JControllerForm {
public function wizardNext()
{
$jinput = JFactory::getApplication()->input;
var_dump($jinput);
$item = $jinput->post->get('topic_id', '', 'STR');
var_dump($topic_id);
}
}
The default is being returned each time from the var_dump($input_id)
Code: Select all
string(0) ""
The value input_id has it's value set in the outfrom from var_dump($jinput)
Though, I noticed the arrays are protected. Has this got anything to do with not being able to retreive the value? How do I get round it? Am I missing something obvious?
Code: Select all
object(Joomla\CMS\Input\Input)#14 (4) {
["inputs":protected]=> array(1) {
["cookie"]=> object(Joomla\CMS\Input\Cookie)#31 (4) {
["inputs":protected]=> array(0) { }
["options":protected]=> array(0) { }
["filter":protected]=> object(Joomla\CMS\Filter\InputFilter)#15 (9) {
["stripUSC"]=> int(0) ["tagsArray"]=> array(0) { }
["attrArray"]=> array(0) { }
["tagsMethod"]=> int(0) ["attrMethod"]=> int(0) ["xssAuto"]=> int(1)
["tagBlacklist"]=> array(23) {
[0]=> string(6) "applet" [1]=> string(4) "body" [2]=> string(7) "bgsound" [3]=> string(4) "base" [4]=> string(8) "basefont" [5]=> string(6) "canvas" [6]=> string(5) "embed" [7]=> string(5) "frame" [8]=> string(8) "frameset" [9]=> string(4) "head" [10]=> string(4) "html" [11]=> string(2) "id" [12]=> string(6) "iframe" [13]=> string(6) "ilayer" [14]=> string(5) "layer" [15]=> string(4) "link" [16]=> string(4) "meta" [17]=> string(4) "name" [18]=> string(6) "object" [19]=> string(6) "script" [20]=> string(5) "style" [21]=> string(5) "title" [22]=> string(3) "xml"
}
["attrBlacklist"]=> array(6) {
[0]=> string(6) "action" [1]=> string(10) "background" [2]=> string(8) "codebase" [3]=> string(6) "dynsrc" [4]=> string(10) "formaction" [5]=> string(6) "lowsrc"
}
["blacklistedChars":"Joomla\Filter\InputFilter":private]=> array(4) {
[0]=> string(5) "&tab;" [1]=> string(7) "&space;" [2]=> string(7) ":" [3]=> string(8) "&column;"
}
}
["data":protected]=> &array(4) {
["XDEBUG_SESSION"]=> string(14) "XDEBUG_ECLIPSE" ["8be08ee85a49325b8f1e38df2d6fe05d"]=> string(26) "mr1adj5ath8p19pb62uoffgcmh" ["joomla_user_state"]=> string(9) "logged_in" ["7b4c0ab6f661f3abead242e2e7b6acb7"]=> string(26) "14d5okcts1q8r0g069jmv8ls8j"
}
}
}
["options":protected]=> array(0) { }
["filter":protected]=> object(Joomla\Filter\InputFilter)#20 (8) {
["tagsArray"]=> array(0) { }
["attrArray"]=> array(0) { }
["tagsMethod"]=> int(0) ["attrMethod"]=> int(0) ["xssAuto"]=> int(1) ["tagBlacklist"]=> array(23) {
[0]=> string(6) "applet" [1]=> string(4) "body" [2]=> string(7) "bgsound" [3]=> string(4) "base" [4]=> string(8) "basefont" [5]=> string(6) "canvas" [6]=> string(5) "embed" [7]=> string(5) "frame" [8]=> string(8) "frameset" [9]=> string(4) "head" [10]=> string(4) "html" [11]=> string(2) "id" [12]=> string(6) "iframe" [13]=> string(6) "ilayer" [14]=> string(5) "layer" [15]=> string(4) "link" [16]=> string(4) "meta" [17]=> string(4) "name" [18]=> string(6) "object" [19]=> string(6) "script" [20]=> string(5) "style" [21]=> string(5) "title" [22]=> string(3) "xml"
}
["attrBlacklist"]=> array(6) {
[0]=> string(6) "action" [1]=> string(10) "background" [2]=> string(8) "codebase" [3]=> string(6) "dynsrc" [4]=> string(10) "formaction" [5]=> string(6) "lowsrc"
}
["blacklistedChars":"Joomla\Filter\InputFilter":private]=> array(4) {
[0]=> string(5) "&tab;" [1]=> string(7) "&space;" [2]=> string(7) ":" [3]=> string(8) "&column;"
}
}
["data":protected]=> &array(6) {
["option"]=> string(16) "com_schemeofwork" ["layout"]=> string(4) "edit" ["id"]=> string(1) "0" ["jform"]=> array(4) {
["id"]=> string(0) "" ["topic_id"]=> string(1) "6" ["learning_objective_id"]=> string(1) "0" ["ks123_pathway_id"]=> string(1) "0"
}
["task"]=> string(10) "wizardNext" ["9bcc2e848f881816f262de3ed3cdaff2"]=> string(1) "1"
}
}