Gossamer Forum
Home : Products : Links 2.0 : Customization :

Add.html and Category field

(Page 1 of 2)
> >
Quote Reply
Add.html and Category field
Hmm,
Where does the category field in add.html get it's input data? I'm capturing all data from that page except category data. I using the set to "1" feature.

I went the wrong direction somewhere. Besides using a custom template and set = "1", I'm using the MOD that changes the "_" and "/" to " " for display. I just noticed that I'm not capturing the category data.

I use <%category%> to display the field in the "category" field on the form. But I never addressed the issue of actually adding. I figuered it was handled somewhere else do the the set = "1" issue.

Do I need to make "category" imput a "hidden" field or where should I look for possible problems?

Thanks
Jeff


Quote Reply
Re: Add.html and Category field In reply to
What is this?

Quote:
I using the set to "1" feature.

Is that from some kind of mod?
Quote Reply
Re: Add.html and Category field In reply to
Sorry for not being complete. No, Actually I was referring to the auto data slect when this is set to "1"

# Should your add.cgi automatically select what category the user
# is adding his link into?
$db_single_category = 1;

I went into validate.db to see if I could figure out what was happening. My data is being sent over as, for the Category field:

|CategoryDATA/SubCategoryDATA~~CategoryDATA/SubCategoryDATA|

any idea where this dupe could be coming from ?

Thanks
JEff


[This message has been edited by JWells (edited June 19, 1999).]
Quote Reply
Re: Add.html and Category field In reply to
The double tilde (~~) would indicate that you are using a duplicate variable someplace. Have you defined the category variable twice?

It seems to me that, in the template, you should be using <%Category%> (with a capital C), not <%category%>. This variable comes from sub site_html_add_form in site_html_templates.pl which should look like this:

Code:
sub site_html_add_form {
# --------------------------------------------------------
# This routine determines how the add form page will look like.
#
&html_print_headers;

my $category = shift;
my $clean_category = &build_clean($category);
$category ?
($category = qq~$clean_category <input type=hidden name="Category" value="$category">~) :
($category = &build_select_field ("Category", "$in{'Category'}"));

print &load_template ('add.html', {
Category => $category,
%globals
});
}

I hope this helps.
Quote Reply
Re: Add.html and Category field In reply to
Bobsie,
Man you're the best - Thanks I nearly went "posta;" trying to find wher that could be coming from.

I was using the Webcrawler Templates and transferred his site_html_templates.pl. This is the code reference the section to told me to look into. I see the dupe defination at the bottom .. at leat I think that is what it is.

*****
sub site_html_add_form {
# --------------------------------------------------------
# This routine determines how the add form page will look like.
#
&html_print_headers;

my $category = shift;
$category ?
($category = qq~$category <input type=hidden name="Category" value="$category">~) :
($category = &build_select_field ("Category", "$in{'Category'}"));

print &load_template ('add.html', {
Category => $category,
category => $category,
%globals
});
}


***********
I'm going to replace his code with the code you sent me and see what happends

Thanks again Bob,
Jeff


[This message has been edited by JWells (edited June 20, 1999).]
Quote Reply
Re: Add.html and Category field In reply to
 Frown

I'm really confused. I replaced my site_html_template.pl with the originial one and the same with my add.cgi and I'm still getting the silly dupes. Even re-did my add.html template.

Where else might I find something ?

Thanks, really stuck on this one.
Jeff
Quote Reply
Re: Add.html and Category field In reply to
Dumb question (maybe) but did you refresh the pages in your browser after rebuilding? If there is only one definition for Category now, you should no longer be getting dupes.
Quote Reply
Re: Add.html and Category field In reply to
Hi Bobsie,
Yep, I tired that too .. thanks. This is crazy .. it has to be something dumb and I'm over looking.

Everything is fine, until I hit add .. then it doubles. I can watch it by displaying <%Category%> in a few places.

I don't have a clue what to try next besides an entire reload and I would really hate to do that.

any other ideas are welecomed Smile

thanks
Jeff
Quote Reply
Re: Add.html and Category field In reply to
Is it possible you have a hidden input tag for Category as well in the Add form?
Quote Reply
Re: Add.html and Category field In reply to
Hi Bobsie,
I know, I was thinking that too. That was why I went as far to build a new add.html .. well that and fustration.

Bobsie, I really hate asking this of you ... I know how busy you are, but would you mind if I sent you my files via e-mail??

I'm thiking you would probably need add.cgi and site_html_templates.html or I would also be open to giving FTP access. Since I'm the begger here, I'm open to almost anything Smile


thanks again,
Jeff
Quote Reply
Re: Add.html and Category field In reply to
I think it would be easiest to look via ftp; just email me the instructions. That way, I can look over all the files I need to instead of asking for them to be sent via email if they weren't sent to begin with.

Also, what is the URL I can use to go see the problem itself?
Quote Reply
Re: Add.html and Category field In reply to
Thanks, they are on their way Smile
Jeff
Quote Reply
Re: Add.html and Category field In reply to
I got the email. I will get back to you as soon as I get the water out of my basement. As I always say, "whenever you have something to do, something else always has to be done first."
Quote Reply
Re: Add.html and Category field In reply to
Hi Bob,
Thanks Smile

Leave the water and buy a large industrial pool filter and two ducks.

Then when people come over you just tell them. That the spa place didn't have a whirlpool large enough for all your friends and the ducks. So you had to adapt your basement.

Now the ducks are the best part. You go to the township and have them reclassify your zoning as a non-profit wildlife sanctuary and get your property taxes reduced. This will help you afford the pool filter. I'm not sure what state you’re in, but some states will stock your private lake with trout and bass. If you can pull this off, you also now qualify for wetlands Smile

Disclaimer: This is by no means legal advice and you should seek an attorney's advice before proceeding Smile

If your luck is anything like mine you would do all of this and then the darn basement would "suddenly" dry up and you would be left with quacking ducks, a basement that smelled like dead fish and a pool filter too big for the bathtub.

Good luck Bob, I guess you can tell I have a basement as well Smile

Thanks
Jeff



Quote Reply
Re: Add.html and Category field In reply to
ROTFLMAO!

Thanks, Jeff, I needed that! Damn, but I wish I'd read that before my mother went and paid out all that money to put a drainage system around her house. Never make decisions on expensive "improvements" before you explore every option!

Phoenix
Quote Reply
Re: Add.html and Category field In reply to
Quack! Quack! (blub.... blub... gasp... blub...)
Quote Reply
Re: Add.html and Category field In reply to
Hi Bob,
any luck or ideas ?

Thanks
Jeff
Quote Reply
Re: Add.html and Category field In reply to
Hi Bob,
It was the site_html_add_failure area. I added the code in there and I heard the trumpts of victory Smile

Thanks for your help, or I would still be out there.

Now, for one more small thing:
On every Thursday that is between a full moon and a new moon, but does not fall within a leap year and the person entering the data the was born on a odd numbered day, and have a shoe size between 9 and 10,

I would like to know if I can do the following .... Wink



Jeff


[This message has been edited by JWells (edited June 24, 1999).]
Quote Reply
Re: Add.html and Category field In reply to
This was a hard one to track down but I finally did it. It is as I suspected. You ARE using a "hidden" input tag because you use <%Category%> in multiple places in your add.html file. The only place you should use <%Category%> is in the add form itself.

Modify your sub site_html_add_form in site_html_templates to look like this:

Code:
print &load_template ('add.html', {
clean_category => $clean_category,
Category => $category,
%globals
});

and then use <%clean_category%> instead of <%Category%> outside of the add form in add.html.

In the process of testing this, I made some other changes to some of your scripts. I will send you email shortly letting you know what they were.

Glad I finally found this as it was bugging me bigtime!
Quote Reply
Re: Add.html and Category field In reply to
Hi Bob,
Thanks and I mean that big time!

I learned something today too. I didn't realize that just by using it in several places it would act like a hidden field. I thought I had to actually define it as hidden.

You can be sure that is one lesson I won't be forgetting soon. I understand what I should change and will make the changes.

Once again, thank you very much for helping me track this down and the other changes you are recommending.

Best Regards and may your basement always be dry Smile

Jeff
Quote Reply
Re: Add.html and Category field In reply to
 
Code:
$category ?
($category = qq~$clean_category <input type=hidden name="Category" value="$category">~) :
($category = &build_select_field ("Category", "$in{'Category'}"));

define a hidden <input> tag if the $category is not blank or a select list if it is blank. Since <%Category%>, which points to $category, is defined as either an <input> tag or select list, it can only be used inside the form. If you use it outside the add form in the same template, you are just putting in another <input> tag or select list, thus Links was telling you it was a duplicate but accepting it in case that was what you really wanted. Smile
Quote Reply
Re: Add.html and Category field In reply to
Bob,
Still a small snag. When I click "submit" from my add page (template), I'm getting the error message:

Unkown Tag: clean_category

Is there somewhere else I need to define this field?

Here are the changes I made so far to sites_html_templates.pl
#*************************************

sub site_html_add_form {
# --------------------------------------------------------
# This routine determines how the add form page will look like.
#
&html_print_headers;

my $category = shift;
my $clean_category = &build_clean($category);
$category ?
($category = qq~$clean_category <input type=hidden name="Category" value="$category">~) :
($category = &build_select_field ("Category"));

print &load_template ('add.html', {
clean_category => $clean_category,
Category => $category,
%globals
});
}

#**********************************
actaul code formatting is off from cut and paste action

Thanks
Jeff


[This message has been edited by JWells (edited June 24, 1999).]
Quote Reply
Re: Add.html and Category field In reply to
I am not sure if this is the problem or not, but you might try adding the clean_category lines to sub site_html_add_failure as well. It shouldn't be needed in sub site_html_add_success though, but one never knows.

All I know is, on my test bed, it worked just fine as I described it. Without knowing which template file is returning the error, it is hard to say what the problem is. I suspect it is add.html since that is the only one you use clean_category in so far.
Quote Reply
Re: Add.html and Category field In reply to
I just noticed, your add form doesn't have <%Category%> in it at all anymore. You still need it in the add form in add.html, right here:

Quote:
<tr bgcolor="#CCCCFF">
<td width="76"><font face="Arial, Helvetica, sans-serif" size="2">Category:
</font></td>
<td width="344"><%Category%></td>
</tr>

[This message has been edited by Bobsie (edited June 24, 1999).]
Quote Reply
Re: Add.html and Category field In reply to
You can't do that the way Links is currently written because there are no bones in ice cream!
> >