Sinatra for Interactive Forms? HTML5/JQuery

Discussion in 'Ruby' started by thunk, Dec 9, 2010.

  1. thunk

    thunk Guest

    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
     
    thunk, Dec 9, 2010
    #1
    1. Advertising

  2. Re: Sinatra for Interactive Forms? HTML5/JQuery

    On Thu, Dec 9, 2010 at 1:10 AM, thunk <> 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/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 ------------------------
    twitter: @hassan
     
    Hassan Schroeder, Dec 9, 2010
    #2
    1. Advertising

  3. Re: Sinatra for Interactive Forms? HTML5/JQuery

    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/.
     
    Mike Stephens, Dec 9, 2010
    #3
  4. Re: Sinatra for Interactive Forms? HTML5/JQuery

    On Thu, Dec 9, 2010 at 7:59 AM, Mike Stephens <> 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 ------------------------
    twitter: @hassan
     
    Hassan Schroeder, Dec 9, 2010
    #4
  5. thunk

    Walton Hoops Guest

    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/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.
    > Thanks for any thoughts/recommendations on this!
    >
    >
    > George
    >
    >
    >
     
    Walton Hoops, Dec 9, 2010
    #5
  6. thunk

    thunk Guest

    Re: Sinatra for Interactive Forms? HTML5/JQuery

    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
     
    thunk, Dec 10, 2010
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Adrienne Boswell

    Re: HTML5 Forms Question

    Adrienne Boswell, Jun 17, 2010, in forum: HTML
    Replies:
    4
    Views:
    908
    BootNic
    Jun 23, 2010
  2. Ed Howland
    Replies:
    1
    Views:
    141
    Konstantin H.
    Oct 26, 2010
  3. Aaron Gray
    Replies:
    20
    Views:
    415
    Lasse Reichstein Nielsen
    Jul 27, 2008
  4. lorlarz
    Replies:
    6
    Views:
    223
    David Mark
    Mar 25, 2010
  5. Gene Wirchenko
    Replies:
    3
    Views:
    649
    John G Harris
    Nov 10, 2011
Loading...

Share This Page