I comeback with another problem.
I am trying to get some values from a form POST in my controller, using JInput. The problem is that the method doesn't return any value whatsoever. The thing is that when i try to dump the variable, the values exist in the input object.
Here is some code.
The controller.
public function save($key = null, $urlVar = null){
$result = parent::save($key, $urlVar);
$request = JFactory::getApplication()->input;
$requestTitle = $request->get('title', 'default title','string');
$requestAnnouncement = $request->get('announcement', 'default announcement', 'string');
//$requestGroups = JRequest::getVar('groups', array(), 'post','array');
//$recepients = $this->_getUserEmailsAndNamesFromGroup($requestGroups);
ob_start();
var_dump($request);
$data = ob_get_clean();
$mailSent = $this->_sendEmail(
array(
'title'=>$requestTitle,
'announce'=>$data),
array('[email protected]')
);
if(!$result || !$mailSent){
$this->setRedirect(
JRoute::_(
'index.php?option=' . $this->option . '&view=announces', false
)
);
}
return $result;
}
And the dump.
object(JInput)#7 (4) {
["options":protected]=>
array(0) {
}
["filter":protected]=>
object(JFilterInput)#8 (7) {
["tagsArray"]=>
array(0) {
}
["attrArray"]=>
array(0) {
}
["tagsMethod"]=>
int(0)
["attrMethod"]=>
int(0)
["xssAuto"]=>
int(1)
["tagBlacklist"]=>
array(22) {
[0]=>
string(6) "applet"
[1]=>
string(4) "body"
[2]=>
string(7) "bgsound"
[3]=>
string(4) "base"
[4]=>
string(8) "basefont"
[5]=>
string(5) "embed"
[6]=>
string(5) "frame"
[7]=>
string(8) "frameset"
[8]=>
string(4) "head"
[9]=>
string(4) "html"
[10]=>
string(2) "id"
[11]=>
string(6) "iframe"
[12]=>
string(6) "ilayer"
[13]=>
string(5) "layer"
[14]=>
string(4) "link"
[15]=>
string(4) "meta"
[16]=>
string(4) "name"
[17]=>
string(6) "object"
[18]=>
string(6) "script"
[19]=>
string(5) "style"
[20]=>
string(5) "title"
[21]=>
string(3) "xml"
}
["attrBlacklist"]=>
array(5) {
[0]=>
string(6) "action"
[1]=>
string(10) "background"
[2]=>
string(8) "codebase"
[3]=>
string(6) "dynsrc"
[4]=>
string(6) "lowsrc"
}
}
["data":protected]=>
&array(9) {
["option"]=>
string(15) "com_bettingtips"
["layout"]=>
string(4) "edit"
["id"]=>
string(1) "0"
["jform"]=>
array(12) {
["title"]=>
string(4) "p[lm"
["announcement"]=>
string(4) "pplm"
["active"]=>
string(1) "1"
["email_sent"]=>
string(1) "1"
["name"]=>
string(0) ""
["description"]=>
string(0) ""
["published"]=>
string(1) "1"
["created"]=>
string(0) ""
["created_by"]=>
string(1) "0"
["created_by_alias"]=>
string(0) ""
["modified"]=>
string(19) "0000-00-00 00:00:00"
["modified_by"]=>
string(1) "0"
}
["task"]=>
string(5) "apply"
["524060c11890c5c4804226d12d9d0976"]=>
string(1) "1"
["c310a666f2ba05c42e0e4fea2d8e84b0"]=>
string(32) "52146dc34590ee3cb5c87307e3139a9a"
["toplevel_page_shortcodes-ultimate_last_tab"]=>
string(1) "0"
["ja_elastica_tpl"]=>
string(11) "ja_elastica"
}
["inputs":protected]=>
array(2) {
["cookie"]=>
object(JInputCookie)#23 (4) {
["options":protected]=>
array(0) {
}
["filter":protected]=>
object(JFilterInput)#8 (7) {
["tagsArray"]=>
array(0) {
}
["attrArray"]=>
array(0) {
}
["tagsMethod"]=>
int(0)
["attrMethod"]=>
int(0)
["xssAuto"]=>
int(1)
["tagBlacklist"]=>
array(22) {
[0]=>
string(6) "applet"
[1]=>
string(4) "body"
[2]=>
string(7) "bgsound"
[3]=>
string(4) "base"
[4]=>
string(8) "basefont"
[5]=>
string(5) "embed"
[6]=>
string(5) "frame"
[7]=>
string(8) "frameset"
[8]=>
string(4) "head"
[9]=>
string(4) "html"
[10]=>
string(2) "id"
[11]=>
string(6) "iframe"
[12]=>
string(6) "ilayer"
[13]=>
string(5) "layer"
[14]=>
string(4) "link"
[15]=>
string(4) "meta"
[16]=>
string(4) "name"
[17]=>
string(6) "object"
[18]=>
string(6) "script"
[19]=>
string(5) "style"
[20]=>
string(5) "title"
[21]=>
string(3) "xml"
}
["attrBlacklist"]=>
array(5) {
[0]=>
string(6) "action"
[1]=>
string(10) "background"
[2]=>
string(8) "codebase"
[3]=>
string(6) "dynsrc"
[4]=>
string(6) "lowsrc"
}
}
["data":protected]=>
&array(3) {
["c310a666f2ba05c42e0e4fea2d8e84b0"]=>
string(32) "52146dc34590ee3cb5c87307e3139a9a"
["toplevel_page_shortcodes-ultimate_last_tab"]=>
string(1) "0"
["ja_elastica_tpl"]=>
string(11) "ja_elastica"
}
["inputs":protected]=>
array(0) {
}
}
["post"]=>
object(JInput)#421 (4) {
["options":protected]=>
array(0) {
}
["filter":protected]=>
object(JFilterInput)#8 (7) {
["tagsArray"]=>
array(0) {
}
["attrArray"]=>
array(0) {
}
["tagsMethod"]=>
int(0)
["attrMethod"]=>
int(0)
["xssAuto"]=>
int(1)
["tagBlacklist"]=>
array(22) {
[0]=>
string(6) "applet"
[1]=>
string(4) "body"
[2]=>
string(7) "bgsound"
[3]=>
string(4) "base"
[4]=>
string(8) "basefont"
[5]=>
string(5) "embed"
[6]=>
string(5) "frame"
[7]=>
string(8) "frameset"
[8]=>
string(4) "head"
[9]=>
string(4) "html"
[10]=>
string(2) "id"
[11]=>
string(6) "iframe"
[12]=>
string(6) "ilayer"
[13]=>
string(5) "layer"
[14]=>
string(4) "link"
[15]=>
string(4) "meta"
[16]=>
string(4) "name"
[17]=>
string(6) "object"
[18]=>
string(6) "script"
[19]=>
string(5) "style"
[20]=>
string(5) "title"
[21]=>
string(3) "xml"
}
["attrBlacklist"]=>
array(5) {
[0]=>
string(6) "action"
[1]=>
string(10) "background"
[2]=>
string(8) "codebase"
[3]=>
string(6) "dynsrc"
[4]=>
string(6) "lowsrc"
}
}
["data":protected]=>
array(3) {
["jform"]=>
array(12) {
["title"]=>
string(4) "p[lm"
["announcement"]=>
string(4) "pplm"
["active"]=>
string(1) "1"
["email_sent"]=>
string(1) "1"
["name"]=>
string(0) ""
["description"]=>
string(0) ""
["published"]=>
string(1) "1"
["created"]=>
string(0) ""
["created_by"]=>
string(1) "0"
["created_by_alias"]=>
string(0) ""
["modified"]=>
string(19) "0000-00-00 00:00:00"
["modified_by"]=>
string(1) "0"
}
["task"]=>
string(14) "announce.apply"
["524060c11890c5c4804226d12d9d0976"]=>
string(1) "1"
}
["inputs":protected]=>
array(0) {
}
}
}
}
Thanks.
The current "official" way to load a POST request using Joomla core from a form constructed with the JForm object and an XML definition is like so:
$data = JFactory::getApplication()->input->post->get('jform', array(), 'array');
Hope this helps.