From: Walton Hoops Date: 2010-12-10T03:06:00+09:00 Subject: Re: Sinatra for Interactive Forms? HTML5/JQuery 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 > > >