Welcome back from what is hoped was a relaxing break. OK, we're almost there! Without changing the calendar widget code from Reply 9 in the previous thread, following is the code used to implement your suggestion.
When the below code executes, it results in an internal server error. Interpreting this to mean that code is not finding the CalendarWidget.pm perl module. Can you discern what my problem could be?
#! /usr/bin/perl -wT # use strict; #force all variables to be declared before use use CGI qw(:standard escape escapeHTML); # most common CGI interface f +unctions use CGI::Carp qw(warningsToBrowser fatalsToBrowser); #all diags to bro +wser use URI; use lib qw(/home/gmacfadd/public_html/cgi-bin/Calendar); use CalendarWidget; my $selected_date; my ($get_calendar_widget, $item); my $choice = lc (param ("choice")); # get choice, lowercased my $url1 = URI->new('http://www.gmacfadden.com/cgi-bin/Calendar/Calend +arWidget.pm'); my $url_picture = URI->new('http://www.gmacfadden.com/images/calendar. +jpg'); my @field_list = ({ name => "selected_date", label => "Select a date:" }); print header (), start_html (-title => "Test CGI Form", -bgcolor => "o +range"); if ($choice eq "") # initial script invocation { display_entry_form (); } elsif ($choice eq "submit") { process_form (\@field_list); } elsif (defined (param("get_calendar_widget"))) { if ($get_calendar_widget eq "get_calendar_widget") { if ($item eq "item1") { my($y1,$m1,$d1)= CalendarWidget::calendar_widget(); print "<br>You selected $y1-$m1-$d1.<br>\n"; $selected_date = $y1."-".$m1."-".$d1; } else {} } else { } } else { print p (escapeHTML ("Logic error, unknown choice: $choice")); } print end_html (); exit (0); sub display_entry_form { my @row; # define array print start_form (-action => url ()); #default method is POST push (@row, qq(<table border=3 bordercolor="blue" align="left" + bgcolor="xffff00">) ); push (@row, Tr ( ( qq(<TD ALIGN="CENTER" VALIGN="TOP" BGCOLOR="yellow" COLSPAN="2">) +, qq(Please provide the information requested in the table below.) ) ) ); push (@row, Tr ( ( qq(<TD ALIGN="RIGHT" VALIGN="TOP">), qq(Select a date:) ), ( qq(<TD ALIGN="LEFT" VALIGN="TOP" BGCOLOR="yellow">), (textfield (-name => "selected_date", -size => 10 +)), a({-href=>$url1}, img({-src=>"$url_picture", -alt +=>"click calendar to select a date"}) ) ) )); print table (@row), submit (-name => "choice", -value => "Submit"), end_form (); } sub process_form { my $field_ref1 = shift; # reference to field-List my @errors; $selected_date = param ('selected_date'); foreach my $f (@{$field_ref1}) { if ( ($f->{name} eq "selected_date") ) { push (@errors, $f->{label}) if $selected_date eq +""; #it's empty! } else { } } if (@errors) { print p ("Some information is missing." . " Please fill in the following fields:"); s/:$// foreach (@errors); # strip colons from end of labels print ul (li (\@errors)); # print column names display_entry_form (); # redisplay entry form return; } print p ("The date entered was $selected_date.<br>\n"); }

In reply to Re^11: obtaining yyyy-mm-dd via a calendar object by gmacfadden
in thread obtaining yyyy-mm-dd via a calendar object by gmacfadden

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.