[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Trying to pre-populate HTML form

Posted on 2011-03-23
9
Medium Priority
?
359 Views
Last Modified: 2012-05-11
I'm trying to pre-populate a form and the following is giving me trouble.

Here is the HTML on the form:
<div id="pbx_upload_html_0" class="pbx_upload_group pbx_hidden">
      <div class="pbx_upload_block">
            <div class="pbx_upload_block_input"><input name="photo" type="file" /></div>
            <div class="pbx_upload_block_clear pbx_hidden"><a href="#" class="pbx_upload_remove_file" onclick="return false;">Remove file</a></div>
      </div><div class="pbx_upload_block">
            <div class="pbx_upload_block_input"><input name="photo" type="file" /></div>
            <div class="pbx_upload_block_clear pbx_hidden"><a href="#" class="pbx_upload_remove_file" onclick="return false;">Remove file</a></div>
      </div><div class="pbx_upload_block">
            <div class="pbx_upload_block_input"><input name="photo" type="file" /></div>

            <div class="pbx_upload_block_clear pbx_hidden"><a href="#" class="pbx_upload_remove_file" onclick="return false;">Remove file</a></div>
      </div>
</div><div id="pbx_upload_html_1" class="pbx_upload_group">
      <div class="pbx_upload_block">
            <div class="pbx_upload_block_input"><input name="photo" type="file" /></div>
            <div class="pbx_upload_block_clear pbx_hidden"><a href="#" class="pbx_upload_remove_file" onclick="return false;">Remove file</a></div>
      </div><div class="pbx_upload_block">
            <div class="pbx_upload_block_input"><input name="photo" type="file" /></div>

            <div class="pbx_upload_block_clear pbx_hidden"><a href="#" class="pbx_upload_remove_file" onclick="return false;">Remove file</a></div>
      </div><div class="pbx_upload_block">
            <div class="pbx_upload_block_input"><input name="photo" type="file" /></div>
            <div class="pbx_upload_block_clear pbx_hidden"><a href="#" class="pbx_upload_remove_file" onclick="return false;">Remove file</a></div>
      </div>
</div>

I thought this would do it:

WebBrowser2.Document.All.Item("pbx_upload_html_0").Value = "test.jpg"

But, it is not.
0
Comment
Question by:hrolsons
[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
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 60

Expert Comment

by:HainKurt
ID: 35200754
try

WebBrowser2.Document.GetElementById("pbx_upload_html_0").Value = "test.jpg"

0
 

Author Comment

by:hrolsons
ID: 35200782
HainKurt:  I tried that and got:

Run-time error '438':
Object doesn't support this property or method.
0
 
LVL 8

Expert Comment

by:imantas
ID: 35201344
Currently, "pbx_upload_html_0" is assigned to the DIV which isn't supposed to support "Value".
You should assign ID to the INPUT element instead of DIV and then try to change it's value, but I'm not sure about the inputs with type="file".

WebBrowser2.Document.All.Item("pbx_upload_html_input_0").Value = "test.jpg"

Open in new window


Where "pbx_upload_html_input_0" is the ID of the input.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 60

Expert Comment

by:HainKurt
ID: 35201418
what are you trying to do?

WebBrowser2.Document.GetElementById("pbx_upload_html_0").innerHTML = "<img src='test.jpg'>"

is this what you want?

0
 

Author Comment

by:hrolsons
ID: 35201611
imantas: I got:

Run-time error '91':
Object variable or With block variable not set.
0
 

Author Comment

by:hrolsons
ID: 35201627
HainKurt:

I didn't get an error with your code, but it didn't do what i needed.

What I'm trying to do is automate the upload of a file.  I normally go to the website, click in the textbox and choose my file with my mouse.  Now, I want, let's say C:\test.jpg, to be automatically put into the textbox.
0
 
LVL 5

Accepted Solution

by:
MedievalWarrior earned 2000 total points
ID: 35202485
The problem is the input type used "file" this doesn't allow you to insert values as security measure. If you could then it would let anyone upload files from a users computer just by visiting the website. It just makes sure the user is really making the choice.. Maybe disable security
0
 
LVL 5

Assisted Solution

by:MedievalWarrior
MedievalWarrior earned 2000 total points
ID: 35202497
Here is link that I missed to go with the previous post

PRB: Cannot Use Script to Manipulate INPUT TYPE=File Value
http://support.microsoft.com/kb/266087
0
 

Author Closing Comment

by:hrolsons
ID: 35202517
Bummer
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses

656 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