Support

  1. PIC DIGITAL
  2. Bug Report
  3. Friday, October 11 2019, 02:17 PM
Hi,

Change value of select box field, checkbox field and radio button field via JsnUser Object API doesn't work .

alias civilite (checkbox) :

1|M
2|Me


$jsnuser->civilite=1;


alias statut (selectbox) :

|Sélectionner son statut
1|Cadre supérieur
2|Cadre
3|Agent de maîtrise
4|Retraités et autres
5|Sans emploi

$jsnuser->statut=1;



Could you help me please ?
PIC DIGITAL Accepted Answer
Hi,

I managed to display selectbox value of php form in the select field of easy profile via API but I don't manage to do for checkbox field and date field ?


Could you help me please ?
  1. more than a month ago
  2. Bug Report
  3. # 1
PIC DIGITAL Accepted Answer
Hi,

I managed to display date value of php form in the date field of easy profile via API but I don't manage to do for checkbox field.

I try to do

$jsnuser->civilite=0

or

$jsnuser->civilite='0'


But there is no result in profile page or in user detail page of joomla back office.

alias civilite (checkbox) :

0|M
1|Me



Could you help me please ?
  1. more than a month ago
  2. Bug Report
  3. # 2
admin Accepted Answer
Admin
Hi,
sorry for late reply, I see this discussione resolved, it is so?

Anyway
Probably you have this issue because checkbox field allow multiple values, so the correct value to assign is an array, so try something like this
$jsnuser->civilite=array('0')


Also, unfortunately due to some PHP version the value 0 is read as empty value, so I recommend to use options like:
1|M
2|Me
  1. more than a month ago
  2. Bug Report
  3. # 3
PIC DIGITAL Accepted Answer
Content Protected
  1. more than a month ago
  2. Bug Report
  3. # 4
PIC DIGITAL Accepted Answer
Hi,

I reopen the post because I found the origin of the issue and I need to have an update of the source code of easy profile :

When I change the setting Readonly (frontend) to "yes" for checkbox I can't fill my field via JsnUser Object API becausein source code there is an issue.

In the file checkboxlist.php the function "storeData" make an unset of array "storeData" if option "field_readonly" is true

We have no deletion of array "storeData" for other fields in function storeData of files selectlist.php, radiolist.php, etc.
We want just a disabled attribute in the input html tag.

Could you update your source code and tell me where I can add disabled attibute when field_readonly option is true in the code of checkbox tag ?


=>

public static function storeData($field, $data, &$storeData)
{
//if($field->params->get('field_readonly','')==1 && JFactory::getApplication()->isSite()) return;
//if($field->params->get('field_readonly','')==2 && JFactory::getApplication()->input->get('task')=='profile.save' && JFactory::getApplication()->isSite()) return;
$alias=$field->alias;
if(isset($data[$alias])) $storeData[$alias]=json_encode($data[$alias]);
else $storeData[$alias]='';
if($field->params->get('field_readonly','')=="1" && JFactory::getApplication()->isSite() && isset($storeData[$alias])) {unset($storeData[$alias]);}
if($field->params->get('field_readonly','')=="2" && JFactory::getApplication()->input->get->get('task','')=='profile.save' && JFactory::getApplication()->isSite() && isset($storeData[$alias])) {unset($storeData[$alias]);}
}


Thanks and Regards

PIC DIGITAL
  1. more than a month ago
  2. Bug Report
  3. # 5
PIC DIGITAL Accepted Answer
Content Protected
  1. more than a month ago
  2. Bug Report
  3. # 6
admin Accepted Answer
Admin
Hi,
thanks for your tip, we will think to some other solution, the code commented allow the field to be not writable also when there is code injected in edit profile page. This is for security purpose, basically if a field is only readable then the user can not change the value also with some trick.
  1. more than a month ago
  2. Bug Report
  3. # 7
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Request Support

Support is currently Offline

Support Availability

Working days: Monday to Friday. The support staff is not available on weekends; in the most of cases tickets will not be answered during that time.

Reply time: Depending on the complexity of your support issue it's usually between a few minutes and 24 hours for paid members and about one week for free members. When we expect longer delays we will notify you.

Guidelines

Before you post: read the documentation and search the forums for an answer to your question.

When you post: include Site Details if you request a support (you can use the form below the reply in Site Details tab).

Auto Solved Question: If after a week the author of the post does not reply to a request by moderator, the question will be marked as resolved.

Language: only English

Search Users

Easy Profile® is not affiliated with or endorsed by Open Source Matters or the Joomla Project. Joomla is Free Software released under the GNU/GPL License.