Gossamer Forum
Home : Products : DBMan : Installation :

2 Questions on html.pl

Quote Reply
2 Questions on html.pl
There are 2 problems I can't get around
1) I wanted to replace values created by a chechbox with some kind of meaningfull phrase like
A field can have only "Yes" and empty
I want something like "Yes, It's Ready" to be printed out instead
To do this I broke html_record subroutine with my own subroutine
It was something like this:
Code:
-----------------------------------
sub description_data {
if ($rec{'Ready'} ne "")
{print qq~
Yes, It's Ready~;
}

else { print qq~""~;}
}
End of Code________________________________

Instead of the desired result I've got my phrase printed in every record no matter if it's empty or not
Q: What's wrong with my sub and what to do?

2) I desided to have my output not as a separate table for each found record but as a separate row of the same table. Guess what - I got lost in the code. It works just fine for a simple output but when it comes to modifying and deleting it all crushes because there are checkboxes and radios inserted as separate rows.
Q: Does anyone have a sample of html.pl where this problem is solved.
2Alex: Wouldn't it be nice to have a collection of alternative html.pl somewhere on your site? =)


------------------
http://ariadna.hypermart.net
Quote Reply
Re: 2 Questions on html.pl In reply to
Hi Ariadna

1.
The code seems fine. Are you sure that $rec{'Ready'} is ever equal to empty. Look at your database file. Have you tried the other way around?

Code:
sub description_data {
if ($rec{'Ready'} eq "Yes")
{print qq~
Yes, It's Ready~;
}

2.
Without looking at the code, my guess is that you are missing some html tag somewhere (probably a </TABLE> )

Cheers
-JO
Quote Reply
Re: 2 Questions on html.pl In reply to
1.Yeeah, I did. I've tried theis and several other ways (once I even tried while instead of if Wink) but with no result. So it remains the same. It looks that for some reason the script does not take "" as &#0124; &#0124; in ne construction and also does not recognise "Yes" for some reason.
Actually I confused the two in my previous posting. It prints nothing when I have ne "" construction and prints the phrase for every record when I use either eq "Yes" or any other ne " " combination
So the problem remains.
I'm sure someone had already dealt with this problem. Help PLS.




------------------
http://ariadna.hypermart.net
Quote Reply
Re: 2 Questions on html.pl In reply to
Hi Ariadna

Have you tried printing it out before the if?
print "HERE--$rec{\"Ready\"}";

See what you get...
Quote Reply
Re: 2 Questions on html.pl In reply to
Yeeah, of course, I did. It all works fine, i.e. prints "Yes" or nothing in correct places.
BTW why do you use backslashes here?
"HERE--$rec{\"Ready\"}";



------------------
http://ariadna.hypermart.net
Quote Reply
Re: 2 Questions on html.pl In reply to
'Cause the print will get confused otherwise. It will think that the second " is the end of the print statement and I have 4 of them. I am just instructing perl that the second and third " are just characters.

Well, then I donīt know... Frown
I use the same code all around and I donīt have problems with it. The only difference is that I use double quotes not single quotes when I call rec. i.e.
Code:
if ($rec{"Ready"} ne "")
{print qq~
Yes, It's Ready~;
}


Try that... maybe we get lucky...

-JO
Quote Reply
Re: 2 Questions on html.pl In reply to
I tend to get confused when there's a lot of negatives. My suggestion is to try:

if ($rec{'Ready'}) {
print "Yes, it's ready.";
}

If there's anything in there, it should print. If not, it shouldn't print anything.



------------------
JPD