views:

139

answers:

8

Hi All

Firstly, i'm still a bit of a noob when it comes to web dev, so please bear with me :)

I have a client that has the following requirements:

  • Require a stand alone web form (in html) to submit to a script and append the details to a csv or xls file
  • Must work without any connection to the internet
  • Must be easy to set up (i.e have an installer or just an unzip and run). This is required so he can distribute it to his sales staff
  • Form to be in HTML if possible so his web designers can change it.

My question is what would be the best way to do this if it's possible at all? Is it possible to write a c# or .NET script / executable that the form posts to without installing the .NET framework?

Any info or advice anybody can give me on this is much appreciated.

Cheers

Fredrik

A: 

Hi,

I think what you are looking for is an embedded web server (library). If you don't want to depend on the .NET framework, you can't build a C# app. You could use native Delphi or C++ or VB or alike..

Your app could then start a browser or embed the browser in a WinForm, accept each HTTP request through the embedded web server and create the CSV file.

You might also look here for libraries.

EDIT: Without your proposals I would do this in e.g. MS Access or even Excel. Cool forms can be realized in both..

Tarnschaf
Yeah i suggested excel to him, but he was adamant that he wanted html so it could easily be styled differently for each one of his sales people.I will look into those libraries, thanks
+1  A: 

If you are going to use .NET, then yes, you need the framework, but that shouldn't be an issue if they are using Windows. Even if they are using XP, you can pretty much count on .NET 2.0 being there -- but, ask them.

You can host a browser control in your WinForm -- that part is easy. You'll need to read the results of submitting the form and not hard-code the fields -- in case they change them.

Lou Franco
A: 

Sounds like a job for the Seaside one-click image. Cross-platform for Linux, OS-X and Windows. Just double-click and you have a webserver running on http://localhost:8080. The form is not directly in HTML though, but that makes it much easier to change. Web designers should be able to make changes to the form after going through the tutorial.

For an introduction, take a look at the tutorial or the book

Stephan Eggermont
+1  A: 

Once it's available, IIS Express might be quite a good solution to your problem. According to Scott Guthrie (note: this is a link to the specific comment on the previously linked post where he confirms the redistributable) there will be a redistributable package.

You'll be able to write the whole thing in asp.net, as if you had a full copy of IIS on a server to work against (as effectively you will!) and provide your client with a nearly painless install by giving them a Windows Installer .msi that installs IIS Express AND the web application, along with creating desktop shortcuts and so on.

Rob
+1  A: 

Sounds like the big requirement is that disconnected sales team members enter data and

append the details to a csv or xls file

Consider a non-web/HTML solution here. Suggest you write an Excel macro and VBA functions so that the sales team can just use the tools they already know. What tools are they using already, and how can you inject functionality into those?

Don't bother with requiring the users set up a local web server, as part of your install. That'll lead to more support calls whose cost will end up outweighing any benefit.

If that fails, consider writing a plain old WinForms app to take the data, and append to csv or xls. It's not clear why the HTML route was suggested, other than so that 'web designers can change it'. Suggest to the customer that their requirements are solved in a non-web fashion.

Remember the reconcile/merge that'll have to eventually happen. Where's that data going? Back into Excel or an RDBMS? If Excel, consider strongly going down the Excel/VBA route.

I suspect the tough part will be to educate and convince the client on how their solution is non optimal, and has a lot of rough edges. Their 'disconnected' requirement is definitely not unique, and leveraging the skills that they already have with Excel should be enough. Why throw more layers into the mix/workflow when it's not really required? The design angle can be approached with: "Does a designer just design/customize for the web, or are they supposed to be able to apply design principles into many environments?"

p.campbell
yeah the local web server is out because i can't see the client or his sales staff installing all that correctly. Can winforms be easily styled?I have thrown a few no-web based options at him (after all, this is technically a non web based app), but he is being a stubborn ass.
@fred: you've then got the problem of merging 1+ .csv files when the sales team gets connectivity back. That'll have to be tackled no matter what offline solution you develop. :)
p.campbell
Local web server is no problem at all if it is a Seaside one-click image. download, unzip, doubleclick.
Stephan Eggermont
+1  A: 

In addition to the other great suggestions, you can avoid the web server requirement by creating a small app that uses the .NET WebBrowser control to display an HTML page. You can set the URL to a local path. Then your app can catch the event triggered by the submit action and append to a local file.

A: 

You need to have all the client's PCs on an internal network at least, and then install a webserver program (Such as apache or IIS) to listen for and to handle the form request from each user on a centralised machine.

IF your client does not have their PC's on an internal network, you will need to install a webserver(or similar) on each of the machines that will be required to use the software. This will generate seperate csv files for each user though. The webserver must be able to process the POST data from your form, so any modern 'server side' language is good enough to do this.

Otherwise you would need to write a program to wait and listen for the request (the form submission). I wouldn't do this personally for what you are trying to achieve.

BTW, I'm not sure its possible to write and run a .NET script without it's underlying framework.

indifferentDrum
+1  A: 

If you must use a web or HTML solution, consider writing an HTML page that:

  • allows the user to enter data in a <form>
  • form's submit action is a JavaScript method
  • use JavaScript to write out the info to a file on disk.
  • your file must have extension .hta
  • run the file from the browser.
  • pretty it up with jQuery as needed. Bundle the jQuery .js along with the .hta file.

Here's a sample application on pastebin. You can see it'll read/write a file, along with reading the form data.

This solution relies on usage of ActiveX in mshta.exe, the Windows HTML Application Host. It shouldn't be too hard to set this as a requirement for users, as it's standard in Windows since the release of IE5.

alt text

p.campbell
Nice idea, I assume it will only work in IE because it is using ActiveX?
Tarnschaf