Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Paragraph breaks in textarea field only for preview page generated by CGI::Formbuilder

by AJRod (Scribe)
on Jun 14, 2004 at 08:36 UTC ( #366443=perlquestion: print w/replies, xml ) Need Help??

AJRod has asked for the wisdom of the Perl Monks concerning the following question:

This is my first time to write a form and I'm using CGI::Formbuilder. I'm needless to say a very poor perl novitiate.

The task involves, among other form elements, the use of a textarea the results of which goes written much later on into a plain text file (PTF) which must remain so, without html tags.

But before that, the form's task is to preview the page to the user through formbuilder's confirm(). However, when this is executed, the text is shown without any paragraph breaks. I have tried making substitutions with the resulting parameters but only the hidden values get modified (by ampersand-coded html tags at that). I need the true html tags temporarily on the preview display page only, not on the actual (hidden) data.

In the template (using HTML::Template), I have tried wrapping the text value in <pre> tags but this doesn't look to good either. (By the way, I'm using one template for both the data entry and preview modes.)

How can I accomplish this in Formbuilder? Anyone's help is much appreciated.

  • Comment on Paragraph breaks in textarea field only for preview page generated by CGI::Formbuilder

Replies are listed 'Best First'.
Re: Paragraph breaks in textarea field only for preview page generated by CGI::Formbuilder
by matthewb (Curate) on Jun 14, 2004 at 13:39 UTC

    I don't think that you are right to be attempting to solve this problem `in Formbuilder'. That you seek to affect the display of your data alone (preserving the actual data as-is) strongly suggests that the solution may best be part of your display logic.

    A solution is, in fact, provided by the Template Toolkit in its built-in html_para_break() filter. Since, however, you say you are using HTML::Template I suggest that you could do a lot worse than looking at the TT2 solution and seeing what you can learn (or pinch!) from it.


      Thank you for broadening my already becoming myopic focus on Formbuilder as the locus of the solution.

      Do you know of a way I can accomplish your suggestion using HTML::Template? I don't know enough of it yet but I'm willing to squeeze what time I have to learn from Template toolkit, though it will take a long time, and longer perhaps to advocate its use by our people at IT or even by other hosts. Not to mention that proposing it will rock the boat of designers here who are already familiar... correction... who have already sedentized their mindset into HTML template.

      Actually, I already made one attempt, at least, in the area of display logic. In the template, I used a <pre> tag to surround the field value. It preserved my data but its display differed from one browser to another, depending on whether they support the deprecated width property of <pre> or not. Does this confirm my growing realization that this and similar moves lead to a dead end as well?

      I know that this was not the solution you were suggesting, I was just musing on alternative rays of light which the erstwhile "forbidden" TT2 offers with its very tempting html_para_break() filter. (Musing also if this view is an excuse for my laziness.)

      Hoping these meditations are not yet too much for you.


Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://366443]
Approved by Tanalis
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2023-12-11 03:32 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (41 votes). Check out past polls.