Buy Now
Sign in

How to get value from the field from custom php code

serguei_kp , December 29 2020, 17:16
S
serguei_kp 105
December 29 2020, 17:16 #395530
Hello, I'm trying to get value of a field 'checkbox104' from custom php code:

$check_box_get = $this->get('checkbox104', 0);
$check_box_data = $this->data('checkbox104', 0);

if ($check_box_data != 1) {
echo $check_box_get;
echo $check_box_data;
$this->data('checkbox104', 1, true);
return $article_note;}
else {
echo $check_box_get;
echo $check_box_data;
return 0;}
but it always returns default value with $this->get or with $this->data.
Array
(
[Itemid] => 1176
[option] => com_content
[view] => article
[id] => 232
[lang] => en
[catid] => 2
[_ga] => GA1.2.108603241.1608997853
[fcba6eff3bcff11268aeb9d73ebac6b2] => b411edc9d98f579395e2c42ed9946e63
[6fc35e6b52a32ae9a673b76d96b4731e] => 945075db290ed8e824ec8c16dc2371be
[joomsef_lang] => en
[_gid] => GA1.2.1966733552.1609255125
[language] => en-GB
[_gat] => 1
[checkbox104] => 1
)
Array
(
[set_checkbox] => Array
(
[returned] =>
[var] =>
)

[default_service_type_php] => Array
(
[returned] => transfer_indi
[var] => transfer_indi
)

[default_service_name_php] => Array
(
[returned] => request-form-all-services
[var] => request-form-all-services
)

[check_box] => Array
(
[returned] =>
[var] =>
)

)
healyhatman 9
December 30 2020, 12:21 #395535
 Answer
$this->data('fieldname', 'optional_default_value_here') is for form data, get is for {var}s
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store