From: "Mills Thomas (app1tam)" Date: 2003-08-22T03:55:05+09:00 Subject: Re: How do I handle an HTML form from ruby? Having Ruby start a browser with the correct form.html file is easy enough. I suspect the tricky part for you is after the user hits the 'Submit' button. That is usually tied to an Action that is typically another web page. At this point, an HTTP server is required (thus the Apache recommendation). That's because when the browser goes to find the Action web page, it expects to be able to communicate to a Web server that is listening on a particular port for web requests. Communication through this port to the web server is how the parameters from the form will get passed to the Action page. I suppose you could write a Ruby program that would listen on a particular port (7829 spells Ruby on the phone keypad!) and maybe could handle it the communication. Is that what you're thinking of? But in this case you're repeating the communication code that is already written in Apache. Drew > -----Original Message----- > From: Ludwigi Beethoven [mailto:aix_tech@yahoo.com] > Sent: Thursday, August 21, 2003 12:28 PM > To: ruby-talk@ruby-lang.org > Subject: Re: How do I handle an HTML form from ruby? > > > OK, first thank you for your help. > Now, let me make an attempt to explain what I want to > do. > > On my quest to learn ruby, I wanted to design a simple > address book application. I wanted to be able to > display some kind of window/form with entry fields for > the mundane items that goes on a phone/address book. > First I thought about using a GUI interfact Tk/Fox. > Then I thought about using something simpler and more > "standard" to collect the data. So after reading about ruby > sopporting html forms and since the majority of the systems > out there use some kind of browser, I thought that perhaps I > could use html ruby support. But it appears that although it > is easy to design the form, it is not that easy to display > it. I wanted to capture input data (phones, addresses, > etc.) and output the same type of data, after a > search. > > Thank you > > --- Pit Capitain wrote: > > On 21 Aug 2003 at 11:52, Ludwigi Beethoven wrote: > > > > > No, I don't have an HTTP server running. I guess I > > > could install apache, but I thought that it was > > much > > > simpler. > > > All the examples make it look simple. Oh well! > > > > Ludwigi, I'm not sure what you want exactly. > > > > > > >I am trying to learn how to manipulate HTML > > files > > > > with > > > > >ruby at the same time that I learn HTML. I > > created > > > > a > > > > >simple html file that contains among other > > things, > > > > >input text fields and some buttons. > > > > What do you mean by "manipulate"? Do you want to > > treat an HTML file > > as text and do some processing on it, for example > > extracting the URL > > of an image, or do you want to build a web > > application that processes > > the user input in some way? > > > > > > >The problem now is: > > > > > > > > > >How do I tell ruby to run the html file? > > > > What do you mean by "run" the file? If you only want > > to look at it, > > then you just ... > > > > > > >Do I need to passit to a browser and if so, > > how? > > > > ... open the file in your browser (usually via the > > File/Open menu). > > > > > > >How do I capture user's input? > > > > This is where you start building a web application. > > If you press the > > submit button in the browser, the browser sends the > > user's input via > > the HTTP protocol somewhere (the target being > > mentioned in the
> > tag). So you need a program that is able to process > > the data. I > > suppose you want to use a Ruby program for that. If > > so, then you have > > several choices, for example Webrick (look in the > > RAA). > > > > HTH > > > > Regards, > > Pit > > > > > __________________________________ > Do you Yahoo!? > Yahoo! SiteBuilder - Free, easy-to-use web site design > software http://sitebuilder.yahoo.com >