implementing a browse button - InfoPath Dev
in

InfoPath Dev

implementing a browse button

Last post 12-06-2005 07:33 PM by Matt Faus. 14 replies.
Page 1 of 1 (15 items)
Sort Posts: Previous Next
  • 10-05-2005 10:00 AM

    implementing a browse button

    I have created a form that uses the Microsoft Common Dialog Control linked to a button in the form to enable users to browse for a file name to insert into a field of type anyuri.

    However, not everyone has this control on their machine. Is there one available as part of the basic operating system (i.e. one that does not have to be distributed with the form) that provides the same functionality?

    Thanks,
    Tim.
  • 10-06-2005 11:12 AM In reply to

    Re: implementing a browse button

    Hi Tim and welcome to our forum,
    Good question! I worked on the Windows Common Dialogs back in NT 3.1 and 3.5 days (early '90s). They have gone through several changes since, but they are available as part of the operating system. You'll want to search MSDN/Google for "Windows Common File Open Dialog" or something like that. It will require code, but you're already using that for the current control. Anyway, good luck.

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 10-21-2005 06:29 AM In reply to

    Re: implementing a browse button

    Thanks, Patrick. I had already tried looking on MSDN/Google but your search string appears to yield much more useful hits.
  • 10-21-2005 07:09 AM In reply to

    Re: implementing a browse button

    Hi,

    Why don't you build you own VB6 Active X control? You just need your own wrapper around the MS control to make it safe for scripting and allow you to add it to InfoPath as a custom control.

    Just a thought...

    Regards,

    Franck Dauché
  • 10-21-2005 09:02 AM In reply to

    Re: implementing a browse button

    Hi, Frank.

    I investigated doing what you suggest a while back but there is very little documentation about what InfoPath needs for the wrapper. Microsoft's Webcast on using custom controls in InfoPath does give an overview, but refers for the details to a document on MSDN that I have not been able to find.

    Unfortunately, it seems there's no way in Javascript to access a DLL, which is what I need.

    Regards,
    Tim.
  • 10-21-2005 09:04 AM In reply to

    Re: implementing a browse button

    Hi Tim,

    Start there:http://blogs.msdn.com/ajma/articles/213868.aspx. You will find everything you need.


    Regards,

    Franck Dauché
  • 10-21-2005 09:58 AM In reply to

    Re: implementing a browse button

    Perfect! Thanks, Frank.
  • 10-21-2005 01:56 PM In reply to

    Re: implementing a browse button

    My pleasure...

    Regards,

    Franck Dauché
  • 10-27-2005 02:10 PM In reply to

    Re: implementing a browse button

    Ok, my results so far... I have successfully created an ActiveX control that implements a browse button and binds the FilePath property to an anyuri field in my data source. However, to be packaged with an InfoPath form, the .cab file containing the ActiveX control has to be digitally signed -- and the method for signing in Andrew Ma's article doesn't work for me. When InfoPath attempts to install the cab file, it displays a message saying the publisher is not trusted and it does not allow me to override it or to add the certificate to my list of trusted publishers. So I can't install the control.

    Do I have to go to a certifying authority and get a certificate?
  • 10-27-2005 05:47 PM In reply to

    Re: implementing a browse button

    Do you have the ability to deploy your form and OCX with an install program such as Wise? You won't have any issue if you can go that way.

    Franck
  • 12-05-2005 06:54 AM In reply to

    Re: implementing a browse button

    I never thought InfoPath would be so frustrating.

    I want to add a simple control to my form that enables the user to open a file browser to specify a file name and path for an anyuri element. This is available in standard HTML forms, using the "file" value for the type attribute of the input element. Why InfoPath does not provide the same functionality in its forms is baffling to me.

    Anyhoo, I created a simple ActiveX control that does the same thing and added it to my InfoPath controls. Like what one gets in an HTML form, it consists of a text box with a button labeled "Browse" beside it that opens a common dialog control to enable the user to select a file. The path and file name text is then copied into the text box.

    Unfortunately, it does not work the same way on all computers on which I have installed the ActiveX control, even though the versions of Windows, InfoPath, and the ActiveX control are all identical. On some computers, the Browse button in the control does not appear. None of the computers complains when the form is loaded and the text box in the control works fine.

    I don't know if this is related to this problme, but I've noticed that forms get rendered differently on different computers, even though, again, all versions of the software are the same. It's as though the page size was smaller in width: tables get squashed and fields get clipped. But the page setup is identical on all the computers.

    Please, please help me, before I'm reduced to a blubbering fool. ;-)

    Thanks,
    Tim.
  • 12-05-2005 08:48 PM In reply to

    Re: implementing a browse button

    Hi Tim,

    The layout changes is really weird. Can you be slightly more specific? Are you sure that the machine hasn't been set to use large fonts or something? That can change it.

    As for the ActiveX frustration, why not just use a file attachment control or a link control?

    I agree that ActiveX can be frustrating, but the problem may be your expectation of InfoPath as an HTML forms replacement. InfoPath is not a replacement for webforms. For simple form applications that need to be linked with Web services or databases, it is much easier to create the InfoPath form than the webform and the maintenance/support value proposition is compelling. However, for applications that browse the file system, you'll want to develop a webform or winform.

    Sorry, if this seems a bit of a lame answer. Just what's on my mind though ...

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 12-06-2005 08:52 AM In reply to

    Re: implementing a browse button

    Hi, Patrick.

    I don't want the user to upload files, I just want them to specify the path and file name. And a link control, to my knowledge, does not allow the user to alter the link URL.

    If I had a way to upload images to this forum, I could show examples of the layout changes. If you let me know your email address, I can send them directly to you.

    I'm using InfoPath for all the good reasons you stated, plus the fact that it natively produces XML files valid to a schema. I have a major application I promised to senior management that is hung up waiting to resolve this simple issue of enabling users to specify a link to a file.
  • 12-06-2005 02:22 PM In reply to

    Re: implementing a browse button

    Hi again,
    Feel free to send e-mail to support@(ourdomain).com.

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 12-06-2005 07:33 PM In reply to

    Re: implementing a browse button

    I know this isn't quite what you're looking for, but what about putting your browse button in an HTML taskpane? This implementation would be incredibly easier, but not nearly as elegant.

    See this thread for more info.
    http://infopathdev.com/forums/topic.asp?TOPIC_ID=1231

    ---------------
    Matt Faus
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (15 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.