[cgiapp] UNC paths on Windows

2006-03-21 Thread Robert Hicks

This may be an Apache thing, I don't know.

I have a script to test my ODBC functionality that connects to a db over 
an UNC path and a mapped path just fine.


I use that same path in my CGI::Application (both the UNC and mapped 
drive and I am getting:


Error executing run mode 'display_task_page': Can't connect to data 
source driver=Microsoft Access Driver 
(*.mdb);dbq=\\Resolver\Users\BHicks\Public\Project_task_report_2003.mde, 
no database driver specified and DBI_DSN env var not set at 
C:/Perl/site/lib/CGI/Application/Plugin/DBH.pm line 42

 at D:/Projects/www/DEV/exp/index.cgi line 14

I am using the following:

use base qw/CGI::Application/;
use CGI::Application::Plugin::DBH (qw/dbh dbh_config/);
use CGI::Application::Plugin::ConfigAuto (qw/cfg cfg_file/);
use CGI::Application::Plugin::ValidateRM (qw/check_rm/);
use CGI::Application::Plugin::AutoRunmode;

Now, if I move that db into a sub-directory in my web application (like 
db/my.db) I can connect to it fine. It seems to be the UNC path it 
doesn't like.


This is the first time I have tried using an UNC path.

Any ideas?

Robert


-
Web Archive:  http://www.mail-archive.com/cgiapp@lists.erlbaum.net/
 http://marc.theaimsgroup.com/?l=cgiappr=1w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[cgiapp] Re: What happens after validation?

2006-03-07 Thread Robert Hicks

Michael Peters wrote:


Robert Hicks wrote:

I have all my forms validating. Yay!


Congratulations.


The question I have is what happens after validation?



$self-redirect('index.cgi?rm=show_next_page');


Change that to

   return $self-show_next_page();

If you do a full redirect then yes, your CGI parameters will be lost, since they
only exist for that request and a redirect performs a separate HTTP request.
This is not C::A specific, but relates to all web programming.

But, after validation, you shouldn't access those values through the CGI query
object. You should get them from the Data::FormValiator::Results object that
check_rm will create.

  $self-check_rm();
  my $results = $self-dfv_results;
  my $user_name = $results-valid('user_name');

This is because your validation profile can have some side effects.
+ It could untaint your data to make it safe for use.
+ If you use filters, they can alter your data (like 'trim', etc)

HTH


That was a great explanation. Thank you very much!

Robert


-
Web Archive:  http://www.mail-archive.com/cgiapp@lists.erlbaum.net/
 http://marc.theaimsgroup.com/?l=cgiappr=1w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[cgiapp] What happens after validation?

2006-03-06 Thread Robert Hicks

I have all my forms validating. Yay!

The question I have is what happens after validation?

If I create a small form like this that doesn't use my validation stuff:

Form without validation:
form action= method=post
table
trtdUsername:/td
td
select name=user_name
option value=/option
option value=NAME1NAME1/option
option value=NAME2NAME2/option
/select
/td
/tr
tr
tdnbsp;/td
td
input type=submit value=Login style=width:5em;nbsp;
input type=reset value=Reset style=width:5em;
/td
/tr
/table
input type=hidden name=rm value=show_task_page /
/form


When I get to the show_task_page I can do $q-param('user_name') and 
get the value from the form.


If I send my page through my validation I no longer can do that. I know 
that because I am passing the value to another page that shows up when I 
do it without validation and doesn't when I validate. I imagine it has 
to do with how I am redirecting out of the validation.


Form with validation:
form action= method=post
table
trtdUsername:/td
td
select name=user_name
option value=/option
option value=NAME1NAME1/option
option value=NAME2NAME2/option
/select
tmpl_var err_user_name
/td
/tr
tr
tdnbsp;/td
td
input type=submit value=Login style=width:5em;nbsp;
input type=reset value=Reset style=width:5em;
/td
/tr
/table
input type=hidden name=rm value=_validate_main_form /
/form

Validation code:

sub _validate_task_form : Runmode {
my $self = shift;
my $q = $self-query;

my ( $results, $err_page ) = $self-check_rm('show_task_page', {
required = [qw/charge_ids project_names task_name 
task_date total_hours/],

constraints = {
total_hours = qr/^(\d*(\.((00?)|(25)|(50?)|(75))0*)?)$/,
},
msgs = {
any_errors = 'err__',
prefix = 'err_',
},
});

return $err_page if $err_page;

$self-redirect('index.cgi?rm=show_next_page');
}

How do I pass the form elements after it has been validated?

I hope I have given you enough to go by this time. I am trying to get my 
head around C::A and all. I suck at forms and I am trying to remedy that 
too!


Robert


-
Web Archive:  http://www.mail-archive.com/cgiapp@lists.erlbaum.net/
 http://marc.theaimsgroup.com/?l=cgiappr=1w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[cgiapp] Re: Validation problem

2006-03-03 Thread Robert Hicks

Mark Stosberg wrote:

On 2006-03-02, Robert Hicks [EMAIL PROTECTED] wrote:
I have a two forms. One on the initial main page and another to input 
tasks. The form on the main page gets validated correctly. I use the 
same code with the second except the fields to validate and it comes 
back with a blank page when I try to validate it.


Robert.

Your profiles look OK. I suspect the problem is elsewhere. 


Mark


Well that sucks. I was hoping I was doing something wrong there.  :\

Robert


-
Web Archive:  http://www.mail-archive.com/cgiapp@lists.erlbaum.net/
 http://marc.theaimsgroup.com/?l=cgiappr=1w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[cgiapp] Re: Validation problem

2006-03-03 Thread Robert Hicks

Mark Stosberg wrote:

On 2006-03-02, Robert Hicks [EMAIL PROTECTED] wrote:
I have a two forms. One on the initial main page and another to input 
tasks. The form on the main page gets validated correctly. I use the 
same code with the second except the fields to validate and it comes 
back with a blank page when I try to validate it.


Robert.

Your profiles look OK. I suspect the problem is elsewhere. 


Mark


It is coming back with this much of my page:

!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;

html xmlns=http://www.w3.org/1999/xhtml;
head
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /
link rel=stylesheet type=text/css href=css/style.css /
titleProject and Task Reporting/title
script language=javascript src=js/cal2.js /

Everything from the /head down is gone.

Robert


-
Web Archive:  http://www.mail-archive.com/cgiapp@lists.erlbaum.net/
 http://marc.theaimsgroup.com/?l=cgiappr=1w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[cgiapp] Re: Validation problem

2006-03-03 Thread Robert Hicks

Michael Peters wrote:


Robert Hicks wrote:


Everything from the /head down is gone.


Sounds like something strange happening. The best way to track this down is to
put some debug warn() statements in the code and watch your error log to see
where the output is being chopped up. Specifically, look at what your run mode
is actually returning.

I stripped out everything. It is just a plain form..no CSS no nothing. 
The main form still validates but the second form does not. *sigh*


Robert


-
Web Archive:  http://www.mail-archive.com/cgiapp@lists.erlbaum.net/
 http://marc.theaimsgroup.com/?l=cgiappr=1w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[cgiapp] Re: [ValidateRM] Validating dropdown boxes...does it work?

2006-03-03 Thread Robert Hicks

There are lots of people that want to help you, but you have to give
them the tools to do so.


I think I will give up for today...


Give it another try, and send us the actual code.  It may just be a
silly little mistake like a typo that just needs another pair of eyes
to spot (you are using strict and warnings right?).


I always use strict and warnings.  :-)

I am sorry I was posting too much with so little. Frustration and not 
being sure how much code I should throw up onto the list I guess.


Anyway, the fix was the comments for the js I was using. I needed to 
leave the embedded author comments between the script tags for the js to 
work. So when I created the page, I move that info into a credits file 
(because I like clean code) and when the js didn't find the comments it 
stopped the rendering. I added the comments back in and ta-da the 
template with the validation works.


Stupid me but it was your give it another try that made me look again.

Thanks for that.

Robert


-
Web Archive:  http://www.mail-archive.com/cgiapp@lists.erlbaum.net/
 http://marc.theaimsgroup.com/?l=cgiappr=1w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[cgiapp] Validation problem

2006-03-02 Thread Robert Hicks
I have a two forms. One on the initial main page and another to input 
tasks. The form on the main page gets validated correctly. I use the 
same code with the second except the fields to validate and it comes 
back with a blank page when I try to validate it.


Any idea looking at this, what the problem might be:

sub validate_main_form : Runmode {
my $self = shift;

my ( $results, $err_page ) = $self-check_rm('show_main_page',
{
required = [qw/user_name/],
filters  = ['trim'],
msgs = {
any_errors = 'err__',
prefix = 'err_',
}
}
);

return $err_page if $err_page;

$self-header_type('redirect');
$self-header_props( -url='index.cgi?rm=show_task_page');
}

sub validate_task_form : Runmode {
my $self = shift;

my ( $results, $err_page ) = $self-check_rm('show_task_page',
{
required = [qw/charge_id project_name task_name task_date 
total_hours/],

filters  = ['trim'],
msgs = {
any_errors = 'err__',
prefix = 'err_',
}
}
);

return $err_page if $err_page;

$self-header_type('redirect');
$self-header_props( -url='index.cgi');
}


-
Web Archive:  http://www.mail-archive.com/cgiapp@lists.erlbaum.net/
 http://marc.theaimsgroup.com/?l=cgiappr=1w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[cgiapp] Validation constraint

2006-02-28 Thread Robert Hicks
I am trying out the ValidateRM plugin. I have it working with one form 
which is cool.


The second form I have deals with hours worked on a project. The hours 
are put in by increments of .25 (i.e. it could be .50 or 7.75). I know I 
can check this with the mod ( % ) operator but I haven't a clue on how 
to make that a constraint for the total_hours field to make sure the 
user is putting in a valid number.


Robert


-
Web Archive:  http://www.mail-archive.com/cgiapp@lists.erlbaum.net/
 http://marc.theaimsgroup.com/?l=cgiappr=1w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[cgiapp] Re: Best free DB for a web-based Perl app response results...

2005-12-01 Thread Robert Hicks
... if i only needed MySQL, i'd use SQL Lite.

Really? I think that would be a poor choice and I like SQLite. ; )

Robert




-
Web Archive:  http://www.mail-archive.com/cgiapp@lists.erlbaum.net/
  http://marc.theaimsgroup.com/?l=cgiappr=1w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[cgiapp] Re: Plugin question

2005-11-18 Thread Robert Hicks
Michael Graham [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

  How do I determine if the cgi_prerun has already been set? If it is set
  how would I add my own prerun code to it?

 If you're only interested in running your code without trampling on an
 existing cgiapp_prerun, you have a couple of options.

 The first option is to call your superclass's cgiapp_prerun from within
 your own:

 package MyApp;
 use base 'MyProject';

 sub cgiapp_prerun {
 my $self = shift;

 # ...do my own prerun stuff

 # call existing cgiapp_prerun first
 $self-SUPER::cgiapp_prerun(@_);

 # ...do some more of my own prerun stuff

 }

 And the second option (if you're using CGI::Application version 4.x) is
 to install a prerun callback:

 package MyApp;
 use base 'MyProject';

 sub cgiapp_init {
 my $self = shift;

 $self-add_callback('prerun', \my_prerun);
 }

 sub my_prerun {
 my $self = shift;

 # ...do my own prerun stuff

 }

 Since you're not overwriting the existing cgiapp_prerun method, this
 second strategy also allows you to tell whether or not there is a
 cgiapp_prerun installed using 'can':

 if ($self-can('cgiapp_prerun')) {
 # yup, there's a cgiapp_prerun there!
 }


 Michael


Thanks Michael!

Robert




-
Web Archive:  http://www.mail-archive.com/cgiapp@lists.erlbaum.net/
  http://marc.theaimsgroup.com/?l=cgiappr=1w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



<    1   2