Solved

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

Posted on 2000-03-08
5
428 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

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

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

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‚Ķ
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

690 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