Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Server Side PERLScript for building forms

by Buckaroo Buddha (Scribe)
on May 22, 2001 at 23:00 UTC ( #82349=perlquestion: print w/replies, xml ) Need Help??

Buckaroo Buddha has asked for the wisdom of the Perl Monks concerning the following question:

i'm trying to write a sub function that will write a date drop down box onto a form this function is going to be called from many pages and should therefore be in another file i'm figuring that i'll call the function like
<form action="foo.asp"> <!--#include virtual="/actest/vtt/includes/DateDropdownSelector.a +sp" --> <% &amp;amp;Month_Dropdown("D1"); %> </form>
and recieve a dropdown
<% sub Month_Dropdown ($prefix) { my @month_order = ("JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG" +,"SEP","OCT","NOV","DEC"); my %month_days = ( JAN => 31, FEB => 29, MAR => 31, APR => 30, MAY => 31, JUN => 30, JUL => 31, AUG => 31, SEP => 30, OCT => 31, NOV => 30, DEC => 31 ); $response->write(qq!<select name="! . $prefix . qq! _MONTH">!); foreach $month (@month_order) { $response->write(qq! <option value="$month">$month! +); }; $response->write(qq!</select>!); $response->write(qq!<select name="! . $prefix . qq! _DAY">!); for ($i = 1;$i <= 31;$i++) { $response->write(qq! <option value="$i">$i!); }; $response->write(qq!<input type="text" name="! . $prefix . qq!_YEA +R" maxlength=4 value="2001">!); } %>
the hash table is in place so i can eventually figure out how to create a dropdown pair on which the number of available days changes based on the month that is selected maybe i shouldn't be including the file as a virtual include but should instead put a 1; at the bottom and say
require /includes/
and then of course fiddle around with the internals a bit (come to think of it, just taking out the <% and %> should complete that transformation anyways ... i know there's a mega -expert out there who can get me over this last little hurdle :)

I forgot to mention that the error that i am recieving is as follows:

PerlScript Error error '80004005' (in cleanup) Can't call method "write" on an undefined value /actest/vtt/includes/DateDropdownSelector.asp, line 19

Replies are listed 'Best First'.
Re: Server Side PERLScript for building forms
by Buckaroo Buddha (Scribe) on May 23, 2001 at 00:01 UTC
    Sorry everyone ... don't mean to waste anyone's time... turns out i was calling
    instead of
    note the capital R? anyways ... the interesting thing is that i can put the above code in an SSI and use the function anywhere in the code. a DATE is automatically embedded on the form and the form elements are named dynamically...

    I'm sure that using a second function can draw the values out of the form again

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://82349]
Approved by root
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2019-08-22 01:13 GMT
Find Nodes?
    Voting Booth?

    No recent polls found