[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Quick ruby-powered html-forms?

Casimir

1/22/2008 11:37:00 AM

I am certain someone has made a solution for quickly creating forms with
ruby. Any ideas? (other than installing rails)

Thanks

Casimir
5 Answers

Jean-François Trân

1/22/2008 12:30:00 PM

0

2008/1/22, Casimir :
> I am certain someone has made a solution for quickly
> creating forms with ruby. Any ideas? (other than installing rails)

You've got plenty templating systems (ERB, Markaby, Haml...),
to name a few. There's also the HtmlExtension module in cgi lib.

-- Jean-Fran=E7ois.

Starr Trader

1/23/2008 12:28:00 AM

0

Casimir wrote:
> I am certain someone has made a solution for quickly creating forms with
> ruby. Any ideas? (other than installing rails)
>
> Thanks
>
> Casimir

Believe it our not, this is still something that seems to be missing
even in rails. Forms can be built from eRB or other template libraries,
but that still requires some fairly close interaction with the nuts and
bolts of the form especially if you want more then just the default
types.

This is an area where the separation of content from presentation is
still a real challenge. It should be possible to describe what data one
wants from the use in one place and make decisions about how to ask for
that data in another. If you have any luck with this let us know.

StarTrader

P.S. This inspired a slightly more length blog post:
http://startrader.wordpress.com/2008/01/22/towards-a-better-way-to-bu...

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

Casimir

1/23/2008 1:45:00 PM

0

Starr Trader kirjoitti:
> Casimir wrote:
>> I am certain someone has made a solution for quickly creating forms with
>> ruby. Any ideas? (other than installing rails)

Thanks for answers, even if no-one so far has presented "the winning
solution".

How to take the pain away from form writing? How to bring back the
POWER? How to avoid dealing with minute form details while trying to
build proper apps/services?

Jean-François Trân kirjoitti:
> You've got plenty templating systems (ERB, Markaby, Haml...),
> to name a few. There's also the HtmlExtension module in cgi lib.

Thank you. To nitpick, you didn't really answer my question, but the
question "what kind of templating systems are there". I didnt ask for a
templating system :) Some would be suitable for what I was asking for.
Haml and Hpricot are now under my investigative gaze...

> Believe it our not, this is still something that seems to be missing
> even in rails. Forms can be built from eRB or other template libraries,
> but that still requires some fairly close interaction with the nuts and
> bolts of the form especially if you want more then just the default
> types.

> This is an area where the separation of content from presentation is
> still a real challenge.

To nitpick, I dont think this is the problem, you have misinterpreted my
question or the concept of content.

Personally, I am just trying to find the simplest, most intuitive (->
fastest) way to create html code for forms. Styling (presentation)
happens entirely in css so it has nothing to do with form content. So I
think you have a slight misinterpretation there.

> It should be possible to describe what data one
> wants from the use in one place and make decisions about how to ask for
> that data in another. If you have any luck with this let us know.

Now this idea I like. Wham! Blam! Thank you mam!

More than words... is what I would like to see... URLs.

Thanks
Csmr

Andrew Stewart

1/23/2008 6:00:00 PM

0


On 23 Jan 2008, at 13:50, Casimir wrote:
> How to take the pain away from form writing? How to bring back the
> POWER? How to avoid dealing with minute form details while trying
> to build proper apps/services?

> Personally, I am just trying to find the simplest, most intuitive (-
> > fastest) way to create html code for forms. Styling
> (presentation) happens entirely in css so it has nothing to do with
> form content. So I think you have a slight misinterpretation there.

> More than words... is what I would like to see... URLs.

If you're using Rails you should look into form builders. When you
create a form like this:

<% form_for @project do |f| %>
<%= f.text_field :name %>
...
<%= f.submit %>
<% end %>

...you are using an instance of Rails' form builder (in the f
variable): ActionView::Helpers::FormBuilder.

I recommend writing your own form builder to generate exactly the
HTML you want.

Here are a couple of custom form builders packaged as plugins:

http://svn.danwebb.net/external/rails/plugins/enhanced_for...
http://opensource.airbladesoftware.com/trun...
air_budd_form_builder/

Regards,
Andy Stewart

-------
http://airbladeso...




khaines

1/23/2008 7:36:00 PM

0

On Wed, 23 Jan 2008, Casimir wrote:

> Personally, I am just trying to find the simplest, most intuitive (->
> fastest) way to create html code for forms. Styling (presentation) happens
> entirely in css so it has nothing to do with form content. So I think you
> have a slight misinterpretation there.

Styling isn't 100% an issue of CSS because of two factors.

1) Any specifics regarding ids or classes to be applied to particular form
elements have to appear in the HTML.

2) Any pecularities regarding the form structure, which ultimately affect
it's appearance in fundamental ways that CSS can't influence, is also part
of the HTML.

So, given those two things, here's how I tend to deal with form generation
in IOWA (iowa.swiftcore.org):

<form oid="do_something">
<label>Choose a number</label>
<listbox oid="number" list="{1..10}" />
<submit value="That's my number!" oid="do_something" />
</form>

This keeps all of the low level details about managing the form out of the
developer's hair. The developer just lays out the structure, and expects
that when the submit button is pressed, do_something() is called, and the
number that was selected will be passed to the number=() accessor.


Kirk Haines