Solved

CGI.pm filefield() don't have a default value

Posted on 2000-03-08
5
420 Views
Last Modified: 2013-12-25
I have tried already lots of things, and notably I have read
the CGI.pm directives in the Perl5 documentation (which is, by
the way, very good).
But no matter what I'm trying, there is no way to set a value for
a filefield() form element.

By the way, I'm working in Win32. Is this another microsoft problem?

My company is going to swicth soon to Linux, and I can't wait!
0
Comment
Question by:gaggio
  • 3
5 Comments
 
LVL 1

Author Comment

by:gaggio
ID: 2598706
Also, I'd like the "Browse" button (which open
the file dialog) to act as a submit button.
Does anybody know how to do that?
Thanks for your help!
0
 
LVL 1

Author Comment

by:gaggio
ID: 2598725
I should have also added that the problem seems
to be that the CGI library can't have access to
the "setvalue" function.
The -onChange=>"myfunction(this)" attribute does not work at all either in filefields
0
 
LVL 4

Expert Comment

by:binkzz
ID: 2599766
You should be able to do this in javascript; if in the perl you write the javascript on that page and specify it in the body onload tag, the value should automatically be inserted; ie:

<body bgcolor=#FFFFFF onload=setvalue();>


<script language=javascript>
  function setvalue()
  {
    document.forms[0].fileinputname.value = 'c:\winnt\test.txt';
  }
</script>



Tom
0
 
LVL 10

Accepted Solution

by:
makerp earned 20 total points
ID: 2600367
aint allowed im affriad

active state help for cgi.pm says

"The optional second parameter is the starting value for the field contents to be used as the default file name (-default).

For security reasons, browsers don't pay any attention to this field, and so the starting value will always be blank. Worse, the field loses its ``sticky'' behavior and forgets its previous contents. The starting value field is called for in the HTML specification, however, and possibly some browser will eventually provide support for it."

therefore that bit of javascript will be ignored by browser

 

0
 
LVL 1

Author Comment

by:gaggio
ID: 2600961
Thanks
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction:   Welcome to my first article ever. To begin with, the reason I write this article.  I participated in a question on Experts Exchange about the start command in Windows and there were some discussion about the usage. The discussio…
It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

680 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question