Javascript may be the answer, but I don't know how to integrate it with my cat & subcat variables yet!!!,( I don't want to have to enter my 18000 cats/Subcats another time) and was hoping to do this in Perl... Now what? Any help is appreciated?#-############################################# # Sub: Add New Item # This allows a new item to be put up for sale sub new { my ($title, $reserve, $inc, $desc, $image, $buyit, @bids); my $inc = '1.00'; # default increment if ($form{'REPOST'}) { $form{'REPOST'} =~ s/\W//g; if (-T "$config{'basepath'}$config{'closedir'}/$form{'REPOST'}.dat") + { open THEFILE, "$config{'basepath'}$config{'closedir'}/$form{'REPOST'}.dat"; ($title, $reserve, $inc, $desc, $image, $buyit, @bids) = <THEFILE>; close THEFILE; chomp($title, $reserve, $inc, $desc, $image, $buyit, @bids); } } print <<"EOF"; <!-- Add the following line to add a back button - between (print <<"E +OF";) & (EOF) --> <input type="button" name="Button" value="Back" onClick="MM_callJS('i +f (history.length > 0){history.back()}')"> ##################### # Post new Item Form <FORM ACTION=$ENV{'SCRIPT_NAME'} METHOD=POST> <H2>Post A New Item</H2> <TABLE WIDTH=100% BORDER=1 BGCOLOR=$config{'colortablebody'}> <INPUT TYPE=HIDDEN NAME=action VALUE=procnew> <TR><TD VALIGN=TOP><B>Title/Item Name:<BR></B>No HTML</TD><TD><INPUT N +AME=TITLE VALUE=\"$title\" TYPE=TEXT SIZE=50 MAXLENGTH=50></TD></TR> <TR><TD VALIGN=TOP><B>Category:<BR></B>Select One</TD><TD> ##################### # Select Main Cat pulldown ###################################################################### +##################### print "<form ACTION=$ENV{'SCRIPT_NAME'} method=post> ", my $catinfo="<!--$form{category}-->";$catinfo=~s/\:/--><!--/g;$catinf +o=~s/<!---->//g; umask(000); my($key, %numfiles, %mycategory, %caticon); foreach $key (keys %category) { next if $category{$key}!~/^\Q$catinfo\E/; opendir(THEDIR, "$config{'basepath'}$key") || mkdir("$config{'basepath'}$key", 0777) || &oops("Category directory $k +ey could not be opened."); readdir THEDIR;readdir THEDIR; my @allfiles = readdir THEDIR; closedir THEDIR; if($category{$key} =~ /^\Q$catinfo\E<!--([^>]*)-->/ && $supercat{$1} + ne ''){ $mycategory{"$form{category}:$1"} = $supercat{$1}; $numfiles{"$form{category}:$1"} += @allfiles; $caticon{"$form{category}:$1"} = $config{supercaticon}; }else{ $mycategory{$key} = $category{$key}; $numfiles{$key} += @allfiles; $caticon{$key} = $config{regularcaticon}; } } my $cols = $config{maincatcols} || 2; my $pc = int(100/$cols); print "<select name=category>", my @keys = sort {lc $mycategory{$a} cmp lc $mycategory{$b}} keys %myc +ategory; my $definedkeys = $#keys + $cols-(($#keys+1)%$cols); my $cmove = int(@keys/$cols); $cmove++ if (@keys%$cols); for(my $i = 0;$i<=$cmove-1;$i++) { # print "<tr>"; my $j = $i; for(1..$cols){ my $key=$keys[$j]; if($key ne ''){ print "<OPTION value=$key>@mycategory{$key}</OPTION>", }else{ print( # Print Padding (Empty Cells) "<td> </td>", ); } $j+=$cmove; } } print ( "<INPUT TYPE='SUBMIT' NAME=action VALUE='go'>", "</select>", "</tr>", ); ###################################################################### +##################### ##################### </SELECT></TD></TR> ######################### <TR><TD VALIGN=TOP><B>Image URL:<BR></B>Optional, should be no larger +than 200x200</TD><TD><INPUT NAME=IMAGE VALUE=\"$image\" TYPE=TEXT SIZE=50 VALUE="http://"></TD></TR> <TR><TD VALIGN=TOP><B>Days Until Close:<BR></B>1-30</TD><TD><INPUT NAM +E=DAYS TYPE=TEXT SIZE=2 MAXLENGTH=2></TD></TR> <TR><TD VALIGN=TOP><B>Description:<BR></B>May include HTML - This shou +ld include the condition of the item, payment and shipping information, and any other information the buyer should know.</TD><TD><TEXTAREA NAME=DE +SC ROWS=5 COLS=45>$desc</TEXTAREA></TD></TR> <TR><TD COLSPAN=2 VALIGN=TOP>Please note that by placing an item up fo +r bid you are making a contract between you and the buyer.<br> Once you place an item, you may not retract it and you must sell it fo +r the highest bid.<br> In other words, if you don't want to sell it, don't place it up for bi +d! EOF if ($config{'regdir'}) { print <<"EOF"; <P><B><A HREF="$ENV{'SCRIPT_NAME'}?action=reg">Registration</A> is req +uired to post or bid!</B></TD></TR> <TR><TD VALIGN=TOP><B>Your Handle/Alias:<BR></B>Used to track your pos +t</TD><TD><INPUT NAME=ALIAS TYPE=TEXT SIZE=30 MAXLENGTH=30> <TR><TD VALIGN=TOP><B>Your Password:<BR></B>Must be valid</TD><TD><INP +UT NAME=PASSWORD TYPE=PASSWORD SIZE=30> <TR><TD VALIGN=TOP><B>Your Starting Bid:</B></TD><TD>\$<INPUT NAME=BID + TYPE=TEXT SIZE=7 VALUE=0> <TR><TD VALIGN=TOP><B>Your Reserve Price:<BR></B>You are not obligated + to sell below this price. Leave blank if none.</TD><TD>\$<INPUT NAME=RESERVE TYPE=TEXT S +IZE=7 VALUE=0> <!-- ############################ --> <TR><TD VALIGN=TOP><B>Bid Increment:</B></TD><TD>\$<INPUT NAME=INC TYP +E=TEXT SIZE=7 VALUE="$inc"></TD></TR> <TR><TD VALIGN=TOP><B>Buy-it Now:</B><BR>Optional, this feature allows + the first bidder to win the auction with a bid at this set price.</TD><TD>\$<INPUT NAME="B +UYIT" TYPE="text" SIZE="7"></TD></TR></TABLE> <!-- ############################ --> EOF } else { print <<"EOF"; </TD></TR> <TR><TD VALIGN=TOP><B>Your Handle/Alias:<BR></B>Used to track your pos +t</TD><TD><INPUT NAME=ALIAS TYPE=TEXT SIZE=30 MAXLENGTH=30> <TR><TD VALIGN=TOP><B>Your E-Mail Address:<BR></B>Must be valid</TD><T +D><INPUT NAME=EMAIL TYPE=TEXT SIZE=30> <TR><TD VALIGN=TOP><B>Your Starting Bid:</B></TD><TD>\$<INPUT NAME=BID + TYPE=TEXT SIZE=7 VALUE=0> <TR><TD VALIGN=TOP><B>Your Reserve Price:<BR></B>You are not obligated + to sell below this price. Leave blank if none.</TD><TD>\$<INPUT NAME=RESERVE TYPE=TEXT S +IZE=7 VALUE=0> <TR><TD VALIGN=TOP><B>Bid Increment:</B></TD><TD>\$<INPUT NAME=INC TYP +E=TEXT SIZE=7 VALUE="$inc"> <!-- ############################ --> <TR><TD VALIGN=TOP><B>Buy-it Now:</B><BR>Optional, this feature allows + the first bidder to win the auction with a bid at this set price.</TD><TD>\$<INPUT NAME="B +UYIT" TYPE="text" SIZE="7"> <!-- ############################ --> <TR><TD VALIGN=TOP><B>Contact Information:<BR></B>Will be given out on +ly to the buyer</TD><TD> <TT>Full Name: </TT><BR><INPUT NAME=ADDRESS1 TYPE=TEXT SIZE=30><BR> <TT>Street Address: </TT><BR><INPUT NAME=ADDRESS2 TYPE=TEXT SIZE=30><B +R> <TT>City, State, ZIP: </TT><BR><INPUT NAME=ADDRESS3 TYPE=TEXT SIZE=30> +</TD></TR></TABLE> EOF } print <<"EOF"; <CENTER>Adult Content IS NOT Allowed!!! <INPUT TYPE=SUBMIT VALUE=Previ +ew></CENTER> EOF }
20040711 Edit by ysth: add code tags
In reply to Re^2: Select Category dropdowns?
by efret
in thread Select Category dropdowns?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |