Gossamer Forum
Home : Products : DBMan : Installation :

Allow to add a field but not to modify it

Quote Reply
Allow to add a field but not to modify it
I have seen different versions to this question but it didn't help me. I try but am limited in Perl skills. If I have a registered user and a database field that is a drop down list that I allow them to select from when they add a record but I don't want them to have access to this same drop down field when they go back to modify the record, how would I do this<-runonsentence. Please give me specifics if it can be done. Such as what file I modify and exactly where in the file I would modify. (i.e., would I need this "}" thing in there somewhere)
Any advice and I'll name my next born after you... Thanks
Quote Reply
Re: Allow to add a field but not to modify it In reply to
The name is Deni....JPDeni. Wink

Okay. In html.pl, sub html_record_form, you will have something similar to the following:

Code:
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>State:</font></TD>
<TD VALIGN="TOP"> |;
print &build_select_field("State","$rec{'State'}");
print qq|</TD></TR>

Right? (I am assuming that you are not using the autogenerate feature. If you are, this won't work.)

You didn't say if you wanted the original value to show up on the form or not. I'm going to assume that you do want it to show, on the modify form, but I can give you the changes so it won't if you would prefer.

Change the code that looks like what I have above so that it looks like this:

Code:
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>State:</font></TD>
<TD VALIGN="TOP"> |;
unless ($modify_record) {
print &build_select_field("State","$rec{'State'}");
}
else {
print $rec{'State'};
}
print qq|</TD></TR>

Then, also in html.pl, but this time in sub html_modify_form_record, just before

&html_print_headers;

add

$modify_record=1;

Now, if you only have one or two fields like this, this is the way to go. If you have a bunch of fields like this, we probably should go a different way.


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





Quote Reply
Re: Allow to add a field but not to modify it In reply to
Works like a charm!! My next born will be named after you. I must now find a spouse to complete my promise :-)
Quote Reply
Re: Allow to add a field but not to modify it In reply to
Deni.....JPDENI... I love the confidence in your message... It's 2am so I'll give it a try tomorrow.... Thanks! Do you ever sleep?
Quote Reply
Re: Allow to add a field but not to modify it In reply to
Do I ever sleep? Occasionally. Smile It's only 12:20 am here, so it's not too late. But I am starting to fade. I think I'm about ready to call it a night myself.


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