Sinatra for Interactive Forms? HTML5/JQuery

T

thunk

Good Evening,

I am an experienced programmer, but new to web programming. We have
a number of interactive forms which, as I understand, will require
HTML5 or JQuery.

A good demonstration of what we need to do is to be found here:
http://remysharp.com/wp-content/uploads/2007/09/select-chain.php

I am investigating using Sinatra, as it seems very concise to move our
GUI App. to being on-line.

As I study Sinatra it is very clear how and where to write blocks of
code that service various "requests" from the form.

What is not clear to me is how this "request" (modified URL - right?)
is "set" on the client side in a situation where the user has
selected, for example, an item in one list and the form needs the
information to fill out another list.

But more fundamental than not understanding how to do this it has not
become clear what tools to use most consistent with Ruby, with minimal
complexity (please don't make me use Java again;;;), and with minimal
maintenance into the future.

Note, we feel we can reasonably require our limited client base to
use the latest HTML5 browsers if they will do what we need such as the
above example.

Perhaps there are plug-ins coming to do this with Sinatra?

Or perhaps there is a "Form Generator" for HTML5 that we can use
(mostly) directly?

Thanks for any thoughts/recommendations on this!


George
 
H

Hassan Schroeder

I am an experienced programmer, but new to web programming. =A0 We have
a number of interactive forms which, as I understand, will require
HTML5 or JQuery.

Probably not true, but...
A good demonstration of what we need to do is to be found here:
http://remysharp.com/wp-content/uploads/2007/09/select-chain.php

The example is basic AJAX; if you're not yet familiar with Javascript,
now's the time to learn. And yes, you can use a library like JQuery to
make it a bit easier, though there are certainly others available.

HTH,
--=20
Hassan Schroeder ------------------------ (e-mail address removed)
twitter: @hassan
 
M

Mike Stephens

Hassan Schroeder wrote in post #967441:
you can use a library like JQuery to
make it a bit easier, though there are certainly others available.

Aren't Ruby programmers supposed to use Prototype or CoffeeScript?
 
H

Hassan Schroeder

Aren't Ruby programmers supposed to use Prototype or CoffeeScript?

I think you're "supposed" to use whatever works for your app and
matches your personal preferences/prejudices :)

The OP may want to google "Javascript libraries" to get an idea of the
many alternatives to JQuery.
 
W

Walton Hoops

Good Evening,

I am an experienced programmer, but new to web programming. We have
a number of interactive forms which, as I understand, will require
HTML5 or JQuery.

A good demonstration of what we need to do is to be found here:
http://remysharp.com/wp-content/uploads/2007/09/select-chain.php

Point of interest, the page you linked is using XHTML (strict) and AJAX
(yes with JQuery). This would also work fine with HTML 4. (Nothing
wrong with using HTML 5 but you will get wider browser compatibility
with HTML 4).
I am investigating using Sinatra, as it seems very concise to move our
GUI App. to being on-line.

As I study Sinatra it is very clear how and where to write blocks of
code that service various "requests" from the form.

What is not clear to me is how this "request" (modified URL - right?)
is "set" on the client side in a situation where the user has
selected, for example, an item in one list and the form needs the
information to fill out another list.
I'm not sure what you mean by this. The usual way to send data from the
client to the server is via a POST via a form or a AJAX call (you can
also do a GET with encoded parameters, but there are some gotchas with
that approach). The data will then be available server-side in the
params hash.

I highly recommend reading the Sinatra book
(http://sinatra-book.gittr.com/). I does an excellent job of explaining
how Sinatra does it's work. http://sinatra-book.gittr.com/#http_methods
contains the POST I was talking about. You will also no doubt have to
learn HTML for this project.
But more fundamental than not understanding how to do this it has not
become clear what tools to use most consistent with Ruby, with minimal
complexity (please don't make me use Java again;;;), and with minimal
maintenance into the future.
Sinatra is an excellent starting point. Without knowing more about what
you are trying to do, I can't recommend any other tools at the moment.
Perhaps there are plug-ins coming to do this with Sinatra?

Or perhaps there is a "Form Generator" for HTML5 that we can use
(mostly) directly?
I've never used it, but the framework Padrino is based on Sinatra and
including HTML generators. Rails also focuses on code generation. For
both of these though, the generated code only gives you a starting
point, you will no doubt have to do a fair amount of customizing.
 
T

thunk

Thank you all very much for all the thoughtful input and links!

The problem is becoming clearer to me. Also I am learning from my
restructuring of our Tk based GUI into something much more like the
architecture used by between HTML and the web-frameworks. (( I have
come up with a scheme where every Tk "Wrapper" Class (Entry Fields,
List Boxes, Labels, Combo Boxes, Radio Buttons all covered now) has a
"Server Side Proxy" class.

My goal is to keep this project as close to 100% Ruby as possible!



Also, my particular application might be of some interest here. It
is, at the core, about getting really Quality data into a format the
computer can use from Natural language. I explain to lay folks that
"we all know GIGO - Well, I'm working on what I think "Quality In"
should look like, and what can be done with it". I have "captured"
1000s of sentences into what I call "Satz" which are Hashes that
follow certain rules. Following is an example I just concocted
tonight to explain some of this to somebody:

The English Sentence

"I understand that the population of Sturgeon Bay, Wi is about 10,000
people" might be rendered so:

{
:QUALIFICATION=>:SELF_UNDERSTANDS,
:pOPULATION_CENTER_TYPE=>:CITY,
:pOPULATION_CENTER_NAME=>"Sturgeon Bay",
:pOPULATION_CENTER_STATE_NAME=>:WISCONSIN,
:pOPULATION_CENTER_COUNTRY_NAME=>:USA,
:pOPULATION_NUMBER=>10000,
:ACCURACY_INDICATION=>:ABOUT
}

From my link given in the first posting, perhaps it can be seen that
"POPULATION" is the column farthest left, and so on.... so somebody
"translating" from natural language can simply use the "vocabulary" of
all the previous keywords used for working with the same topic. Put
simply, you would see only :QUALIFICATION, :pOPULATION, and :ACCURACY
in the first column. If the translator should hit :pOPULATION in the
Listbox, the next listBox will display (at least): CENTER_TYPE,
CENTER_STATE_NAME, CENTER_COUNTRY_NAME, and :NUMBER. (I played with
more levels but two seems to be a 'sweet spot' for people, and the 2nd
column seldom gets over 30 choices anyway.)

Thanks again!

George
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top