# Questions about ruby cgi

**URL:** <https://www.ruby-forum.com/t/questions-about-ruby-cgi/53971>\
**Category:** Ruby\
**Created:** [December 17, 2005, 3:54pm UTC](https://www.ruby-forum.com/t/questions-about-ruby-cgi/53971 "2005-12-17T15:54:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![larrywright](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/9fc348/32.png) [@larrywright](https://www.ruby-forum.com/u/larrywright)\
**Post date:** [December 17, 2005, 3:54pm UTC](https://www.ruby-forum.com/t/questions-about-ruby-cgi/53971/1 "2005-12-17T15:54:25Z")

</div>

I’m trying to use the cgi library to generate some html that will later  
get  
run through erb.

The problem i’m having is that if i try to use the cgi.text\_field method  
it  
automatically escapes anything passed in as the value. That means an erb  
instruction like “\<%= get\_a\_value\_ here %\>” gets escaped and erb ignores  
it.

I looked at the cgi source, but the method that does the work, input(),  
isn’t defined in the main file.

I have two questions:

1. Where would i find the file where the instance method input is  
defined?
2. Is there an easier way around this than trying to hack the cgi  
library?

thanks.

---

<div class="post-metadata">

**Author:** ![larrywright](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/9fc348/32.png) [@larrywright](https://www.ruby-forum.com/u/larrywright)\
**Post date:** [December 17, 2005, 10:19pm UTC](https://www.ruby-forum.com/t/questions-about-ruby-cgi/53971/2 "2005-12-17T22:19:07Z")

</div>

On Sat, 17 Dec 2005, Larry W. wrote:

> I have two questions:
> 
> 1. Where would i find the file where the instance method input is defined?
> 2. Is there an easier way around this than trying to hack the cgi library?

eparklabs will be releasing this in the next few days:

```
  [ahoward@localhost xx-0.0.0]$ cat a.rb
  require "xx"

  class Table < ::Array
    include XX::XHTML

    def to_xhtml
      xhtml_{
        html_{
          head_{ title_{ "table demo" } }

          h1_(:style => :sweet){ "this is a table " }

          h_{ "<malformed html & open tags if you must" }

          table_(:width => 42, :height => 42){
            each{|row|
              tr_{ row.each{|cell| td_ cell } }
            }
          }
        }
      }
    end
  end

  table = Table[%w( 0 1 2 ), %w( a b c )]

  puts table.to_xhtml

  [ahoward@localhost xx-0.0.0]$ ruby -I./lib a.rb
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 

```

“[http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd](http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd)”\>  
  
  
table demo

# this is a table
\<malformed html & open  
tags if you must  
  
  
  
  
  
  
  
  
  
  
  

| 0 | 1 | 2 |
| a | b | c |

  

perhaps i could send you a version offline to test?

## -a

# =============================================================================== | email : ara [dot] t [dot] howard [at] eparklabs [dot] com | uri : [eparklabs.com](http://eparklabs.com) | all happiness comes from the desire for others to be happy. all misery | comes from the desire for oneself to be happy. | – bodhicaryavatara

---

<div class="post-metadata">

**Author:** ![larrywright](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/9fc348/32.png) [@larrywright](https://www.ruby-forum.com/u/larrywright)\
**Post date:** [December 18, 2005, 1:35am UTC](https://www.ruby-forum.com/t/questions-about-ruby-cgi/53971/3 "2005-12-18T01:35:17Z")

</div>

there an easier way around this than trying to hack the cgi library?

> ```
> xhtml_{
> }
> 
> <table height='42' width='42'>
> </table>
> </html>
> 
> ```
> 
> perhaps i could send you a version offline to test?
> 
> -a

Ara-

```
I like the looks of that a lot. Can you send me a copy of list? I

```

will test and give feedback.

Cheers-  
-Ezra
