Hi JPD,
You were right, I had a typo in the url's field name. I also have the email "clickable" now - thanks.
Still on forms though, I am getting the hang of it and making steady progress but I do have a couple of questions.
A couple of posts ago you gave me some examples of form field definitions code which I am using to develop my own form, and I refer in particular to the following
code:
--------------------------------------------------------------------------------
print qq| <table> <tr><td>Name:</td> <td><input type="text" name="Name" value="$rec{'Name'}"></td></tr><input type="hidden" name="Userid" value="$rec{'Userid'}"> <tr><td>Address:</td> <td><input type="text" name="Address" value="$rec{'Address'}"></td></tr>|;if ($per_admin) { print qq| <tr><td>Gender:</td> <td> |; print &build_radio_field("Gender","$rec{'Gender'}"); print qq|</td></tr>|;}else { print qq| <input type="hidden" name="Gender" value="$rec{'Gender'}">|;}print qq| <tr><td>Name of Pet:</td> <td><input type="text" name="Pet" value="$rec{'Pet'}"></td></tr> <tr><td>Favorite Color:</td> <td> |; print &build_select_field("Color","$rec{'Color'}"); print qq|</td></tr> </table> |;
--------------------------------------------------------------------------------
code:
--------------------------------------------------------------------------------
print qq| <table> <tr><td>Name:</td> <td>$rec{'Name'}</td></tr> <tr><td>Address:</td> <td>$rec{'Address'}</td></tr>|;if ($per_admin) { print qq| <tr><td>Gender:</td> <td>$rec{'Gender'}</td></tr>|;}print qq| <tr><td>Name of Pet:</td> <td>$rec{'Pet'}</td></tr>|;if ($rec{'Pet'}) { print qq| <tr><td>Favorite Color:</td> <td>$rec{'Color'}</td></tr>|;}print qq| </table> |;
--------------------------------------------------------------------------------
I am trying to understand it but have to admit I am a bit stumped by the Gender field and what it does.
Code:
if ($per_admin) { print qq| <tr><td>Gender:</td> <td> |; print &build_radio_field("Gender","$rec{'Gender'}"); print qq|</td></tr>|;}else { print qq| <input type="hidden" name="Gender" value="$rec{'Gender'}">|;}
I tried the code and for admin the field displays normally. Other than for admin, there is no field label in the left column nor any record content on the right - So I am wondering why use the else statement at all? - If I want to suppress the record content, why can't I just use the if ($per_admin) condition and leave out the rest - or was there some other intent with this example that I am missing? The only other thing I can think of is if the "if" statement followed the record label, then there would be a label but no record rather than a blank row - but even that does not need the else statement, which actually brings me to a question.
As admin I create all records and assign a userid. The "owner" of the record can only modify own. After I create the base record with all the required fields, the user (owner) can log on and fill in all other fields, however, when logging in, all the required fields (created by admin) can be seen but not edited (like a search result).
So basically something similar to your Gender example but for the else statement, instead of "hidden" it should be "visible but not editable" to coin my own Perl phrase. Please advise if this s possible.
My next question relates to hiding blank fields. If I am not mistaken, the Color field in your example, is an optional field which will not be visible unless a Pet name is entered. So if Pet is empty, Color is hidden. But what if I wanted to hide the Pet field itself assuming it was empty and not a required field.
I would appreciate your help please.
Thanks/regards ais