Gossamer Forum
Home : Products : DBMan : Customization :

Adding code in specific field, how?

Quote Reply
Adding code in specific field, how?
Hi!

How do I do this?

I need to add code/text (like <br><br> etc.) after input, if the input is made, in specific field-name.

For example:

IF the user adds text in field INFO, then the system adds two line feeds in the final page, but doesn't show those codes on input text box (or elsewhere).

info => [2, 'alpha', 40, 255, 0, '<br><br>', ''],

This ^ allmost does it, but the <br>:s are visible in the input box, which I don't want to show. It also confuses the user...and if those are removed, it doesn't (off course) work anymore.

I belive I have to modify the db.cgi, but how...?

Maco
Quote Reply
Re: [maco] Adding code in specific field, how? In reply to
Rather than adding the <BR> tags within the database and taking up space there .. just modify your output display within sub html_record or if using short/long mod
sub html_record_long.

After you place your $rec{'Info'} just add a <P> tag.

Or if you have each field output within a <TR> you could just add an extra <TR><TD colspan=2>&nbsp;</TD></TR> so that there will be space added after the info field.

Hope this helps

Unoffical DBMan FAQ
http://redundantcartridge.com/dbman/
Quote Reply
Re: [LoisC] Adding code in specific field, how? In reply to
Thanks for fast answer!

But, if I add <br>:s (those were just examples. If needed, it could be even javascript code etc.) just after $rec{'Info'}, it makes the line feed even if the INFO box was inputted without any text. I need to add the code, IF the text is given AND only with the specific field name, in this case, Info.

I was trying to modify the $rec{'Info'} (on html.pl) to this: $rec{'Info' + '<br><br>'}, but it doesn't work.

Maco
Quote Reply
Re: [maco] Adding code in specific field, how? In reply to
If you want the field to be displayed only if there is text within that field you could use:

|;
if ($rec{'INFO'}) { print qq|$rec{'INFO'}<P>|;}
print qq|

Unoffical DBMan FAQ
http://redundantcartridge.com/dbman/
Quote Reply
Re: [LoisC] Adding code in specific field, how? In reply to
That was it!! Thank you very much!