Solved

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

Posted on 2000-03-08
5
424 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Business Impact of IT Communications

What are the business impacts of how well businesses communicate during an IT incident? Targeting, speed, and transparency all matter. Find out more in this infographic.

Question has a verified solution.

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

Suggested Solutions

Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
The viewer will learn how to count occurrences of each item in an array.

732 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