Gossamer Forum
Home : Products : DBMan : Customization :

optional view

Quote Reply
optional view
Hi,

I have this query. When someone is searching for record , I want to give him the option for viewing the fields he wants to view. For example in my database I have the following fields Name | Address | Phone | Education.

The user during the search should be able to select which are the options he wants to see. The option will be in the form of check box or radio button. For example he chooses Phone number , then on the phone numbers will be extracted and shown as result.

Please help me with his
Quote Reply
Re: [cybermen] optional view In reply to
In html_record_form, you'd need to name your checkbox (I think that's the best way to go) something like view_fieldname. Then, in html_record, you'd make it a condition. Something like

Code:

if ($in{view_fieldname}) {
print qq|whatever your formatting is for that field|;
}

You would not be able to use the autogenerate feature for this.

One thing to be aware of is that you would be effectively elminating the "List All" feature, unless you did some extra programming.

Note that the full record would always be extracted from the database. The checkbox would just determine which field(s) to display.


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.

Last edited by:

JPDeni: May 10, 2005, 6:30 PM
Quote Reply
Re: [JPDeni] optional view In reply to
What exactly do you mean by that the list all feature will be disabled. Please can you tell me what is required to be done to have the list all enabled with this.
Quote Reply
Re: [cybermen] optional view In reply to
Your example gave the fields "Name | Address | Phone | Education". I'm assuming that you would have a checkbox beside each one on the search form and that only those fields that were checked would be displayed. With the List All link, unless you added the code for displaying certain fields, you'd end up with a bunch of blank records.

As for how to fix it, it would depend on what you wanted to display when looking at a List All. You could have one or more fields that don't have a checkbox beside them which are always displayed. Like "Name." If you didn't add the conditional code that I gave before to the section where the Name field is displayed, that field would display just fine with a List All.

Alternatively, you could have everything display when you do a List All. In that case, you would want to add something like &listall=1 to the List All link and then use the following for your conditional display:

Code:

if ($in{view_fieldname} || $in{listall}) {
print qq|whatever your formatting is for that field|;
}


Actually, I was thinking it would be more complicated than that when I wrote before. Things usually seem way more complicated when I first see them than when I later think about them. :-)


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.