Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Sinatra for Interactive Forms? HTML5/JQuery

Reply
Thread Tools

Sinatra for Interactive Forms? HTML5/JQuery

 
 
thunk
Guest
Posts: n/a
 
      12-09-2010

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/uplo...lect-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


 
Reply With Quote
 
 
 
 
Hassan Schroeder
Guest
Posts: n/a
 
      12-09-2010
On Thu, Dec 9, 2010 at 1:10 AM, thunk <(E-Mail Removed)> wrote:

> 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/uplo...lect-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 ------------------------ http://www.velocityreviews.com/forums/(E-Mail Removed)
twitter: @hassan

 
Reply With Quote
 
 
 
 
Mike Stephens
Guest
Posts: n/a
 
      12-09-2010
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?

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
Hassan Schroeder
Guest
Posts: n/a
 
      12-09-2010
On Thu, Dec 9, 2010 at 7:59 AM, Mike Stephens <(E-Mail Removed)> wrote:

> 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.

--
Hassan Schroeder ------------------------ (E-Mail Removed)
twitter: @hassan

 
Reply With Quote
 
Walton Hoops
Guest
Posts: n/a
 
      12-09-2010
On 12/9/2010 2:10 AM, thunk wrote:
> 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/uplo...lect-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.
> Thanks for any thoughts/recommendations on this!
>
>
> George
>
>
>



 
Reply With Quote
 
thunk
Guest
Posts: n/a
 
      12-10-2010

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,
OPULATION_CENTER_TYPE=>:CITY,
OPULATION_CENTER_NAME=>"Sturgeon Bay",
OPULATION_CENTER_STATE_NAME=>:WISCONSIN,
OPULATION_CENTER_COUNTRY_NAME=>:USA,
OPULATION_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, OPULATION, and :ACCURACY
in the first column. If the translator should hit OPULATION 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





 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sinatra and Rails. Was: [ANN] Sinatra 1.1 released! Ed Howland Ruby 1 10-26-2010 06:58 AM
[ANN] Sinatra 0.9.0 released! Ryan Tomayko Ruby 0 01-18-2009 10:11 AM
Interactive/Non-interactive ASPX ? WJ ASP .Net 2 02-26-2005 02:54 AM
non Interactive and Interactive AAH Computer Support 0 01-09-2005 04:09 PM
Interactive and non interactive AAH Computer Support 1 01-09-2005 04:01 PM



Advertisments