Loading ...
Sorry, an error occurred while loading the content.
 

Re: [PBML] Problem with text box in an HTML form.

Expand Messages
  • merlyn@stonehenge.com
    ... Andy The problem I have is this. I have a Perl script that allows me to Andy edit a database entry. It gives me a form with a text box for each of Andy
    Message 1 of 4 , Nov 23, 2007
      >>>>> "Andy" == Andy Schafer <lostgameparts@...> writes:

      Andy> The problem I have is this. I have a Perl script that allows me to
      Andy> edit a database entry. It gives me a form with a text box for each of
      Andy> the 10 lines. The "value" parameter of each text box is set to
      Andy> whatever is currently shown in the database. The problem is that when
      Andy> the text box for the description line encounters an entry containing
      Andy> special characters or html tags it doesn't just show the entry "as-is"
      Andy> from the database. Instead the special characters screw it up. For
      Andy> instance entries containing a <br> tag jump outside the textbox with
      Andy> part of the information.

      How are you generating your html? If you're using CGI.pm, for example,
      you merely have to use:

      print textarea(-name => 'param_name', -default => $existing_value);

      and CGI.pm will do the right escaping. Other templating languages
      have similar features.

      --
      Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
      <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
      Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
      See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
    • Andy Schafer
      Hey Jenda, Thank you so much for your input. I used the solution below that you gave and it works great!! I am very greatful! ... Thank you to all of you who
      Message 2 of 4 , Nov 25, 2007
        Hey Jenda,

        Thank you so much for your input. I used the solution below that you
        gave and it works great!! I am very greatful!

        Jenda Wrote:
        > use HTML::Entities;
        > #...
        >
        > print qq{<input type="text" name="whatever" value="} .
        > encode_entities($whatever) . qq{" onChange="modifiedWhatever()">\n};

        Thank you to all of you who took the time to read my question! This a
        really great group!

        Thank you
        Andy Schafer
      Your message has been successfully submitted and would be delivered to recipients shortly.