HTML posting to ruby script?

Ok new to Ruby.

I have an HTML form that I want a user to enter data, and when the
SUBMIT button is pressed, the HTML POST (with the data) goes to a Ruby
script to process the data (no web server running) into ruby variables
to be used in other Ruby Scripts.

Again this is meant to be able to run offline because ultimately this is
all going into the “Titanium” app runtime (Similar to adobe AIR, but
Ruby and Python runtimes are included), and like AIR can run on any
platform.

In short it becomes a multi-platform desktop app using HTML as the GUI.

Question is, how do I get that ruby script to accept the POST and pull
the data out to make the variables?

Den Sat, 22 Aug 2009 15:07:33 -0500 skrev Brad Mr:

platform.

In short it becomes a multi-platform desktop app using HTML as the GUI.

Question is, how do I get that ruby script to accept the POST and pull
the data out to make the variables?

You need a webserver. Can be a simple one, can even be written in
Ruby, but you do need one.

/Kent

Brad Mr wrote:

Ok new to Ruby.

I have an HTML form that I want a user to enter data, and when the
SUBMIT button is pressed, the HTML POST (with the data) goes to a Ruby
script to process the data (no web server running) into ruby variables
to be used in other Ruby Scripts.

Again this is meant to be able to run offline

Web pages have no access to the local file system–for security reasons.
You wouldn’t be able to browser the internet if a web page could
suddenly flood every folder on your computer with thousands of
advertisements. And you say that the web browser is offline, which
means the web page can’t communicate with a server. So the question is:
where is the ruby script located? You see the dilemma?

7stud – wrote:

Brad Mr wrote:

Ok new to Ruby.

I have an HTML form that I want a user to enter data, and when the
SUBMIT button is pressed, the HTML POST (with the data) goes to a Ruby
script to process the data (no web server running) into ruby variables
to be used in other Ruby Scripts.

Again this is meant to be able to run offline

Web pages have no access to the local file system–for security reasons.
You wouldn’t be able to browser the internet if a web page could
suddenly flood every folder on your computer with thousands of
advertisements. And you say that the web browser is offline, which
means the web page can’t communicate with a server. So the question is:
where is the ruby script located? You see the dilemma?

If that is true then how does Javascript work if you make all function
definition in a single seperate *.js file while, calls to its function,
and you don’t need a web server for that?

Den Mon, 24 Aug 2009 09:17:56 -0500 skrev Brad Mr:

Web pages have no access to the local file system–for security reasons.
You wouldn’t be able to browser the internet if a web page could
suddenly flood every folder on your computer with thousands of
advertisements. And you say that the web browser is offline, which
means the web page can’t communicate with a server. So the question is:
where is the ruby script located? You see the dilemma?

If that is true then how does Javascript work if you make all function
definition in a single seperate *.js file while, calls to its function,
and you don’t need a web server for that?

Javascript runs in the browser.

/Kent

Brad Mr wrote:

In short it becomes a multi-platform desktop app using HTML as the GUI.

You need a small webserver, which can be bound to 127.0.0.1 (so that
browsers on remote machines cannot access it). You would then point your
browser at http://127.0.0.1:xxxx/ where xxxx is whatever port you bound
the webserver to.

Sinatra looks to be a very good match to your requirements.

require ‘rubygems’
require ‘sinatra’
post ‘/submit’ do
… do stuff using posted params[]
… return a string containing the response page
end

Brad Mr wrote:

(no web server running)

A program that handles http messages is called a web server so you have
to have one. The simplest solution is to use the normal Ruby web server
options, running locally as mentioned in another post. Why did you
decide you wanted to avoid this approach?