Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Link details/submisson form depend on category?

Quote Reply
Link details/submisson form depend on category?
Working on a travel-related site with categories like hotels, attraction, restaurants, etc.. and would like to know how the link submission form could change depending on the category it is being submitted to.

For example, users submitting to the hotel category would not need to fill out what type of cuisine is served, or average dinner price.. and users filling out for restaurant category would not need to fill out how many rooms field.

Can this be done on the template level conditionally.. something like if category = 'hotel' show these fields... if category = 'restaurant' show these.. Just wondering. Is there a plug in?

Maybe some of you have already done something similar and can point me in the right direction. Thanks.
Quote Reply
Re: [TNIJason] Link details/submisson form depend on category? In reply to
Hi. You would probably need some custom work done. Either a way to check what the Full_Name of the category is, and then based on that show different submission forms; or a new script, say 'add2us.cgi', which could be passed the type, i.e. add2us.cgi?CatID=1234. I would offer to do this work, but I'm afraid I'm pretty booked up.

Hope that helps a little

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [TNIJason] Link details/submisson form depend on category? In reply to
I use the following type setup for different link submissions.
A bit crude but works.
First I setup a new column in links “LinkType” , I put Classifieds, Regular, Premium.
Then setup appropriate forms with contact form being standard.

Then on the menu bar where you have “Add Link” “ Modify Link” etc
I have the call to page.cgi and it goes to multichoice.html, instead of using the add.cgi
[ add.cgi defaults to load add.html ]
<a class="menu_links" href="<%db_cgi_url%>/page.cgi?p= multichoice">ADD LINK</a>

The user then goes to an intermediate multichoice.html page, then selects what type of link he wants to add,
which is the standard call to add.cgi and will load add.html.

<a href="<%db_cgi_url%>/add.cgi?LinkType=Regular">Regular</a>
<a href="<%db_cgi_url%>/add.cgi?LinkType=Classifieds">Classified</a>

The add.html is loaded and depending on choice and the appropriate form is loaded.

<form action="<%db_cgi_url%>/add.cgi" enctype="multipart/form-data" method="POST">
<input type="hidden" name="LinkType" value="<%LinkType%>">

<%include include_form_contact_details.html%>
<%if LinkType contains 'Premium'%>
<%include include_form_premium_link.html%>
<%elseif LinkType eq 'Regular'%>
<%include include_form_standard_link.html%>
<%else%>
<%include include_form_standard_link.html%>
<%endif%>

Contact Form is standard throughout the database and the others will be for the different type links.

You need to include <input type="hidden" name="LinkType" value="<%LinkType%>"> as above so this is carried through to the confirmation page and is the same as what they have submitted.

There is also the issue of Modifying the links.
modify_select.html
The links for that user will be loaded and depending on the link the following submit buttons will load.

<form action="<%db_cgi_url%>/modify.cgi" method="POST">
<input type="hidden" name="LinkType" value="<%LinkType%>">

Please select which resource you would like to update:

<%if LinkType eq 'Classifieds'%>
<p>
<input type="SUBMIT" value="Modify Ad">
<input type="submit" name="renewal" value="Renew Ad">
<input type="submit" name="remove" value="Remove Ad">
</p>
<%elseif LinkType eq 'Premium'%>
<input type="SUBMIT" value="Modify Premium">
<%else%>
<input type="SUBMIT" value="Modify">
<%endif%>

They will then be taken to modify.html and the appropriate form is loaded.

<form action="<%db_cgi_url%>/modify.cgi" method="POST">
<input type="hidden" name="modify" value="1">
<input type="hidden" name="LinkType" value="<%LinkType%>">

<%include include_form_contact_details.html%>
<%if LinkType contains 'Premium'%>
<%include include_form_premium_link.html%>
<%elseif LinkType eq 'Regular'%>
<%include include_form_standard_link.html%>
<%else%>
<%include include_form_standard_link.html%>
<%endif%>

Don’t forget you must send the link type with submit , add and modify.

This should get you started, PM me and I can give you the URL so you can see the outcome.

If you have a different look for the categories I also use
<input type="hidden" name="Full_Name" value="<%Full_Name%>">
to keep the category look that they are currently in.

Regards

minesite
Quote Reply
Re: [minesite] Link details/submisson form depend on category? In reply to
That's exactly what I do too - very nice explanation.
Edit - In fact, I think this should be added to Andy/Pugdog's new resources site.

Last edited by:

afinlr: Feb 17, 2004, 5:29 AM
Quote Reply
Re: [afinlr] Link details/submisson form depend on category? In reply to
I as well have done something similar. I really wish I could hide all the extra fields for the different kinds of possible submissions. I know that the <%form%> tag in the browser.cgi script can't be touchedFrown
Quote Reply
Re: [nt6] Link details/submisson form depend on category? In reply to
I really wish I could hide all the extra fields for the different kinds of possible submissions.



I'm not sure if this is what you are looking for but you can include hidden fields.
They are submitted with the form but not shown to the user.

<input type="hidden" name="Price" value="Unmerchandisable">
<input type="hidden" name="LinkType" value="Premium">
<input type="hidden" name="Impressions" value="0">

Regards

minesite
Quote Reply
Re: [nt6] Link details/submisson form depend on category? In reply to
Thanks, minesite, and others.. I'll give your suggestion a shot.

Keep the ideas coming, you've all been a big help so far.
Quote Reply
Re: [minesite] Link details/submisson form depend on category? In reply to
I am pretty sure that what you mention only works in the modify.cgi, not in the browser.cgi. In other words it doesn't work with editors in the back office. Please tell me if I am wrong.