In the Drupalgap user profile there is a field that should be viewable, but not be editable by the user. I am using field permissions and the permissions are respected - the user cannot change/save/update the value.
But the field is shown in the edit view of the profile a looks editable. Is this intended?
How can I hide the field in the edit user view? Is targeting the specific field(s) individually with hook_form_alter the best way?
/**
* Implements hook_form_alter().
*/
function my_module_form_alter(form, form_state, form_id){
try {
console.log("Form ID " + form_id); // Use to see the form id.
console.log("FORM: " + JSON.stringify(form)); // Use to inspect the form.
if (form_id == 'user_profile_form') {
$('#edit-user-profile-form-field-points-und-0-value').css("background-color","yellow"); // not working
$('#edit-user-profile-form-field-points').css("background-color","yellow"); //not working
$('#edit-user-profile-form-field-points-und-0-value').hide(); //not working
// not working from: https://www.drupal.org/node/2170427:
form.elements.edit-user-profile-form-field-points-und-0-value = {
// type: 'textfield',
// title: 'My Text Fied',
options: {
attributes: {
disabled: 'disabled'
}
},
access: false /* use this to completely hide the form element */
};
console.log("this is user_profile_form");
}
}
catch (error) { console.log('my_module_form_alter - ' + error); }
}