Gossamer Forum
Home : Products : DBMan : Installation :

Editing and hidding

Quote Reply
Editing and hidding
I want to hide some field so the person who editing their record will not be able to edit this particular field. Anyone got idea please do help me...

------------------
aneip
Quote Reply
Re: Editing and hidding In reply to
I use this...

<input type=hidden name="Whatever" value="$rec{'Whatever'}" >

in your html_record_form

-JO
Quote Reply
Re: Editing and hidding In reply to
I have the newest version of DBMan. I would like to hide the ID and Date field so that a user cannot change them.

I tried adding this code in various places per the example above, but I was unsuccessful. Any help would be greatly appreciated. Thanks.
Quote Reply
Re: Editing and hidding In reply to
If you're using autogenerate, you can set the fields to be hidden in the .cfg file. In the place for "form-length" -- just after the field type (alpha, numer or date) -- put "-1."

If you're defining your own forms and records, the field that Jaime mentioned goes into the html.pl file, sub html_record_form.



------------------
JPD
Quote Reply
Re: Editing and hidding In reply to
I can get the field protected from the users... problem is, the admins can't modify or search the field Frown

I would love to figure out a way so that the users can't mess with the ID or Date fields, yet the admins can.
Quote Reply
Re: Editing and hidding In reply to
Yep. If you don't have the hidden fields on your form, when you add or modify a record those fields will end up to be empty. You will lose any information you had there.

This, of course, assumes that others can add or modify records on your database. If you are the only one to add or modify records, I suppose you could do without the hidden fields.





------------------
JPD
Quote Reply
Re: Editing and hidding In reply to
Thanks JPDeni!

With some modifications, I was able to pull it off. I have a question for future use. Do I need the "else" part of that statement?

Or could I just do something like:
if ($per_admin) {
print qq|blah blah|;
}
else {
}

Quote Reply
Re: Editing and hidding In reply to
You can't do what you want to do as long as you use the autogenerate feature. You'll have to build your own html_record_form and html_record subroutines.

(Actually, I suppose you could just get by with building html_record_form and let html_record autogenerate.)

Anyway, if you build html_record_form, you would add something like

if ($per_admin) {
print qq|<TR><TD>Field label</TD></TR>
<TD><INPUT TYPE="text" NAME="Field" VALUE="$rec{'Field'}></TR></TD>|;
}
else {
print qq|<INPUT TYPE="hidden" NAME="Field" VALUE="$rec{'Field'}>|;
}

Hope this helps.


------------------
JPD