Gossamer Forum
Home : Products : DBMan : Installation :

How to make ID field unchangeable?

Quote Reply
How to make ID field unchangeable?
I have a feeling my users will be making lots of mistakes when entering data into the record fields for the database.

How can I prevent them from changing the ID number that is automatically set by DBMan? I don't want to change it to a hidden field because they'll need to know it for future reference for viewing and searching.
Quote Reply
Re: [smithT] How to make ID field unchangeable? In reply to
You need to use hidden fields, but you can PRINT the value in the form....

Example:

in the sub html_record_form (html.pl)

print qq|UserID:|; if ($per_add) { <input type="hidden" name="ID" value="$rec{'ID'}">} else {<input type="text" name="ID" value="$rec{'ID'}">} print qq| $rec{'ID'}| if ($per_add);

There is no other solution.

Goodbye.
========================================
Buh Bye!

Cheers,
Me

Last edited by:

Heckler: Dec 12, 2001, 5:36 PM
Quote Reply
Re: [Heckler] How to make ID field unchangeable? In reply to
Ok, thanks. I deleted the duplicate post in customization.
Quote Reply
Re: [smithT] How to make ID field unchangeable? In reply to
No problem.

I re-read my post and notice that there are syntax errors all over the place...

Use the following codes:

Quote:

print qq|UserID:|;
if ($per_add) {
print qq|<input type="hidden" name="ID" value="$rec{'ID'}">|;
}
else {
print qq|<input type="text" name="ID" value="$rec{'ID'}">|;
}
print qq| $rec{'ID'}| if ($per_add);


========================================
Buh Bye!

Cheers,
Me

Last edited by:

Heckler: Dec 12, 2001, 8:09 PM
Quote Reply
Re: [Heckler] How to make ID field unchangeable? In reply to
One more question before I add the code you've so nicely written for me.

If I make the field hidden but print it, will it still be available as a searchable field?
Quote Reply
Re: [smithT] How to make ID field unchangeable? In reply to
Not with the subroutine I already told you to post the codes in...If you want that field searchable, then you will have to monkey around with the sub html_record routine.

Best of luck and goodbye.
========================================
Buh Bye!

Cheers,
Me