Gossamer Forum
Home : Products : DBMan : Customization :

hide html_record_form (%rec);

Quote Reply
hide html_record_form (%rec);
     Hello

In the modify sub html there is code as belows;

&html_record_form (%rec);

What i did is add more field only in modify part and want

not to be seen html_form in modify.

Only want show added field in modifying.

How can i hide this: &html_record_form (%rec);

?



Thanks
Quote Reply
Re: [tilmes] hide html_record_form (%rec); In reply to
Do you mean: in the modify form, you only want to show *one* field, whereas in an add form, you want to show all fields specified in html_record_form?

In that case, you can code a different form which is only called for modification.

Replace the line "&html_record_form(%rec);" in sub html_modify_record_form with "&html_modify_record_form(%rec);", and add this sub to your html.pl:

sub html_modify_record_form {

my %rec = @_;

print qq|<input type="text" name="field" value=$rec{'field'} size="30" maxlength="255"><br>|;

foreach my $col (@db_cols) {

unless ($col eq "field") {print qq|<input type="hidden" name="$col" value="$rec{$col}">|;}

}

}

"field" should be replaced by the name of the field you want to be visible in the modification form. The hidden input fields pass on the values of all other fields to dbman.

Hope this helped,
kellner
Quote Reply
Re: [kellner] hide html_record_form (%rec); In reply to
 Thanks a lot Kellner!

I don't understand what do you mean with a code add really.

I have in html_form for example several field like: company, name, telephone...

and want to give more chance to add thire information when they modify records.

And in the modify form added more fields like: description, branch, worker adn so on.

I have now problem on the sub html_modify_failure form.

The information they gave in html_add_form will be taken over to modify form

with input type="HIDDEN".. code in sub html_modify_form_record as belows;

sub html_modify_form_record {

<input type="HIDDEN" name="Firma" value="$rec{'Firma'}">
<input type="HIDDEN" name="Inhaber" value="$rec{'Inhaber'}">

<TR><TD ALIGN="left" VALIGN="TOP" WIDTH="627" colspan="2"><input type="radio" ..........

And whenever modify fails, lost all information they gave in modify_form.

then get a error massage as Error: no matching records.

Under sub html_modify_failure {... changed &html_record_form to

&html_modify_form (%in);

How can let the modify form take over all the information they exist already

and do not get any more error massages like above?
Quote Reply
Re: [tilmes] hide html_record_form (%rec); In reply to
OK, let me check whether I understand you correctly:

1) A user adds data in the fields company, name, telephone etc. in the add_form.

2) Some time later, a user modifies their data. Then they should have the option to add more specific data in fields description, branch, worker.

I'm not sure I understand at what stage precisely you want to offer the possibility to add more specific data, though. After a record is added, or at some stage during the "add record" process?

Du kannst auch auf deutsch antworten, dann verstehe ich's vielleicht besser.
kellner
Quote Reply
Re: [kellner] hide html_record_form (%rec); In reply to
Vielen Dank für die Rückmeldung.

Ich versuche es auf english zu erklären, obwohl meine Sprachkenntnisse

nicht ausreicht.

It is right as you described 1 and 2.

In the modify form took the all the information already added

with a input type="HIDDEN". The error massages comes if i not fiil out the

modify form properly, then lost all the information with massages like;

Error: no matching records.

There is code in modify failure: &html_modify_form (%in);

How can i change it so that take the information through.

I can change each field and specifies as
print qq|
<input type="HIDDEN" name="object" value="%in{'object'}">

but it does not work. HOw can i change this code &html_modify_form (%in);

to each field specifically?

Last edited by:

tilmes: Jan 27, 2002, 1:03 PM
Quote Reply
Re: [tilmes] hide html_record_form (%rec); In reply to
You must have every field defined in your .cfg file also in your html_record_form or you will have problems.

If you only want users to be able to modify certain fields you can use the following example:

<TR><TD><$font><B>Ad Duration:</B></FONT></TD><TD><$font>
|;
if (($per_admin) or (!$in{'modify'})) { print

&build_select_field("duration",$rec{'duration'});
}
else {
print qq|<input type="hidden" name="duration" value="$rec{'duration'}">$rec{'duration'}|;
}
print qq| <B>Days</B></font></TD></TR>

This would keep people from modifying original information you don't want them to change. Not sure if this is what you are looking to do, but it would simplify things.

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] hide html_record_form (%rec); In reply to
Thanks LoisC,

As Kellner described;

1) A user adds data in the fields company, name, telephone etc. in the add_form.

2) Some time later, a user modifies their data. Then they should have the option to add more specific data in fields description, branch, worker.


could user add more infos in modify form where added more extra fields.
Quote Reply
Re: [tilmes] hide html_record_form (%rec); In reply to
Okay, let's try this again Smile Deleted it once already Crazy

You need to have all of your fields listed in the databse configuration file. (Your users cannot "add" fields at a different point unless the fields are already configured.

In sub html_record_form use hidden fields for everything you do not want a visitor to complete when initially entering a record, just like you do with some fields now. (Add the additional hidden fields at the bottom of the table.)

print qq|
<TABLE WIDTH="450" CELLPADDING=0 CELLSPACING=0 BORDER=1 BGCOLOR="#FFFFCC">
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="150"><$font>ID:</FONT></TD>
<TD VALIGN="TOP" WIDTH="475">&nbsp;<INPUT TYPE="TEXT" NAME="ID" VALUE="$rec{'ID'}" SIZE="3" MAXLENGTH="3"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Title:</FONT></TD>
<TD VALIGN="TOP">&nbsp;<INPUT TYPE="TEXT" NAME="Title" VALUE="$rec{'Title'}" SIZE="40" MAXLENGTH="255"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>URL: </FONT></TD>
<TD VALIGN="TOP">&nbsp;<INPUT TYPE="TEXT" NAME="URL" VALUE="$rec{'URL'}" SIZE="40" MAXLENGTH="255"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Type: </FONT></TD>
<TD VALIGN="TOP">&nbsp;|; print &build_select_field ("Type", "$rec{'Type'}"); print qq|</TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Date:</FONT></TD>
<TD VALIGN="TOP">&nbsp;<INPUT TYPE="TEXT" NAME="Date" VALUE="$rec{'Date'}" SIZE="12" MAXLENGTH="12"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Category:</FONT></TD>
<TD VALIGN="TOP">&nbsp;|; print &build_select_field ("Category", "$rec{'Category'}"); print qq|</TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Description:</FONT></TD>
<TD VALIGN="TOP">&nbsp;<TEXTAREA NAME="Description" ROWS="4" COLS="40" WRAP="VIRTUAL" MAXLENGTH="255">$rec{'Description'}</TEXTAREA></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Validated:</FONT></TD>
<TD VALIGN="TOP">&nbsp;|; print &build_radio_field ("Validated", "$rec{'Validated'}"); print qq|</TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Popular:</FONT></TD>
<TD VALIGN="TOP">&nbsp;|; print &build_checkbox_field ("Popular", "$rec{'Popular'}"); print qq|</TD></TR>
|;
### These fields will display only if Admin is viewing record or
### When the record owner is viewing in Modify Mode
if (($per_admin) or (($db_uid eq $rec{Userid}) && $in{'modify'})) {
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Another Field:</FONT></TD>
<TD VALIGN="TOP">&nbsp;<INPUT TYPE="TEXT" NAME="AnotherField" VALUE="$rec{'AnotherField'}" SIZE="40" MAXLENGTH="255"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Field Was Hidden: </FONT></TD>
<TD VALIGN="TOP">&nbsp;<INPUT TYPE="TEXT" NAME="FieldWasHidden" VALUE="$rec{'FieldWasHidden'}" SIZE="40" MAXLENGTH="255"></TD></TR>
|;
}
else {
print qq|
<INPUT TYPE="HIDDEN" NAME="AnotherField" VALUE="$rec{'AnotherField'}">
<INPUT TYPE="HIDDEN" NAME="FieldWasHidden" VALUE="$rec{'FieldWasHidden'}">
|;
}

### Now we resume printing to close the table.
print qq|
</TABLE>
|;
}

- - - - - -
Then, you do not need to make a bunch of modifications to your sub html_modify_form.

Last edited by:

Karen: Jan 27, 2002, 3:30 PM
Quote Reply
Re: [tilmes] hide html_record_form (%rec); In reply to
Still not sure whether I understand you, but I spotted one error in the code:

instead of ".... value="%in{'object'}" ..., write "... value="$in{'object'}".

As LoisC indicated, you must have all fields in your database defined in the cfg-file. But I suppose she misunderstood what you want. You don't want users to add new database fields, but to add new *INFORMATION* for already defined fields when a record is modified.
kellner
Quote Reply
Re: [Karen] hide html_record_form (%rec); In reply to
Hello Karen,

Thanks a lot for the change you brought to!

It works perfect!! Without an error at all.Sly

It saved a lot of html code through out modify form and works without an error.

I have an another idea which requires same logic.

The first part where will be seen in add, view and modify form as belows;

print qq|
<TABLE WIDTH="450" CELLPADDING=0 CELLSPACING=0 BORDER=1 BGCOLOR="#FFFFCC">
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="150"><$font>ID:</FONT></TD>
<TD VALIGN="TOP" WIDTH="475">&nbsp;<INPUT TYPE="TEXT" NAME="ID" VALUE="$rec{'ID'}" SIZE="3" MAXLENGTH="3"></TD></TR> .........qq|</TD></TR> |;



How can i hide it in the part of modify form? Could be seen like as;

if (($per_admin) or (($db_uid eq $rec{Userid}) && $in{'view'})) {

print qq|
<TABLE WIDTH="450" CELLPADDING=0 CELLSPACING=0 BORDER=1 BGCOLOR="#FFFFCC">
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="150"><$font>ID:</FONT></TD>
<TD VALIGN="TOP" WIDTH="475">&nbsp;<INPUT TYPE="TEXT" NAME="ID" VALUE="$rec{'ID'}" SIZE="3" MAXLENGTH="3"></TD></TR> ..............


|;
}
else {
print qq|
<INPUT TYPE="HIDDEN" NAME="ID" VALUE="$rec{'ID'}">
<INPUT TYPE="HIDDEN" NAME="Title" VALUE="$rec{'Title'}"> ........
|;
}

Last edited by:

tilmes: Jan 28, 2002, 1:06 PM
Quote Reply
Re: [tilmes] hide html_record_form (%rec); In reply to
It's good to hear the first suggestion worked for you. I'm not real certain what you are trying to do in the second modification. Would you mind trying to reword what you'd like to do? Thanks!
Quote Reply
Re: [Karen] hide html_record_form (%rec); In reply to
Hello Karen,

The modify you wrote gave a very good hint for the second modification which i changed a little bit just above that hidden part and it works again.

I tried in second modification not showing the Title, ID, Type, URL and so on

in the modify form when the guest enters with modify authority.

It solved through the changes as belows;


if (($per_admin,$per_view,$per_add) or (($db_uid eq $rec{Userid}) && $in{'add'})) {
print qq|
<TABLE WIDTH="450" CELLPADDING=2 CELLSPACING=0 BORDER=0 BGCOLOR="#FFFFCC">
<input type="hidden" NAME="ID" VALUE="$rec{'ID'}">
<TR><TD ALIGN="left" VALIGN="TOP" WIDTH="627" colspan="2"><input type="radio" name="Branche" value="Immobilienmakler_Bauträger"><$font_color> Immobilienmakler / Bauträger</FONT></TD></TR>......................

|;
}
else {
print qq| <input type="HIDDEN" name="ID" value="$rec{'ID'}">...............

It seems like the puzzel is not really ended which i am seeing

more cracking things to do.

Can be really done a work that make one more Search form?

There are two forms in this html.pl now where the guest can log in either

as add or modify authority. If a guest login with view authority

they can only look for ID, Title, URL and so on, not the other hidden part ( modified

also search_form already). Can i create another search form?

So that There will be $per_admin,$per_del,$per_view,$per_view01,$per_mod,$per_add;