I have a form that collects user input. In this form, I have two hidden fields for the administrators to put their initials in one field area and notes in the other field area. These two fields are hidden, and do not show up on the form that the user sees. I can see the hidden fields when I select the "show data" in chrono connect. However, when I select an entry in chronoconnect to edit, it populates the original chronoform, minus the hidden fields. Is there any way to edit a hidden field in the backend without having to use phpMyAdmin?
Hi bobcameron,
Hidden fields aren't editable - the way round this is to use a little PHP to check if the user is an admin or not. If they are then show them as normal input fields, if not then show them as hidden fields.
Bob
Hidden fields aren't editable - the way round this is to use a little PHP to check if the user is an admin or not. If they are then show them as normal input fields, if not then show them as hidden fields.
Bob
Bob,
What a fast response! I am php challenged. Would you elaborate a little on what I need to do and where? Some of us code challenged people will greatly benefit!
Joomla code to determine if user is admin or superadmin:
What do I need to add to this? And where to put this code?
Joomla 1.5.11
Community Builder 1.2
Thank you,
Bob Cameron
What a fast response! I am php challenged. Would you elaborate a little on what I need to do and where? Some of us code challenged people will greatly benefit!
Joomla code to determine if user is admin or superadmin:
$user =& JFactory::getUser();
if($user->usertype == "Super Administrator" || $user->usertype == "Administrator"){
echo 'You are an Administrator';
{
else{
echo 'You are just an ordinary user';
}
What do I need to add to this? And where to put this code?
Joomla 1.5.11
Community Builder 1.2
Thank you,
Bob Cameron
Hi bobcameron,
That's pretty much it.
Bob
Later: fixed typo - see next post.
That's pretty much it.
<?php
$user =& JFactory::getUser();
// Note: in practice I'd use $user->gid here
if ( in_array ( $user->usertype, array("Super Administrator","Administrator") )){
$admin = true;
} else {
$admin = false;
}
?>
. . .
<?php
if ( $admin ) {
?>
<input type='text' name='special_field' value='xxx' />
<?php
} else {
?>
<div>id: 'xxx' </div>
<input type='hidden' name='special_field' value='xxx' />
<?php
}
?>
Bob
Later: fixed typo - see next post.
Had to add a couple )) in the line - if ( in_array ( $user->usertype, array("Super Administrator","Administrator"))) {
once this was done, it worked perfectly!
Thanks for the help!
once this was done, it worked perfectly!
Thanks for the help!
<?php
$user =& JFactory::getUser();
// Note: in practice I'd use $user->gid here
if ( in_array ( $user->usertype, array("Super Administrator","Administrator"))) {
$admin = true;
} else {
$admin = false;
}
?>
. . .
<?php
if ( $admin ) {
?>
<input type='text' name='special_field' value='xxx' />
<?php
} else {
?>
<div>id: 'xxx' </div>
<input type='hidden' name='special_field' value='xxx' />
<?php
}
?>
This topic is locked and no more replies can be posted.