Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Print a perl array to html textarea ...

Reply
Thread Tools

Print a perl array to html textarea ...

 
 
Moti
Guest
Posts: n/a
 
      01-04-2008
Hi Guys,
After I got my indigoperl to work I want to build an application that
get data from the html textarea parse it and then return it to the
same text area (deleting the original text).
My parser returns a perl array (@output_array) which I want to print
to the html text area.
Where can I find an example on how to perfrom this ?
Thanks in advance, Moti.
 
Reply With Quote
 
 
 
 
Paul Lalli
Guest
Posts: n/a
 
      01-04-2008
On Jan 4, 9:16*am, Moti <(E-Mail Removed)> wrote:
> Hi Guys,
> After I got my indigoperl to work I want to build an application that
> get data from the html textarea parse it and then return it to the
> same text area (deleting the original text).
> My parser returns a perl array (@output_array) which I want to print
> to the html text area.
> Where can I find an example on how to perfrom this ?


perldoc CGI

as an example...
use CGI qw/:standard/;
print textarea(
-name=>'mytext',
-rows=>10,
-columns=>50,
-default=>join('', @output_array)
);


Paul Lalli
 
Reply With Quote
 
 
 
 
Moti
Guest
Posts: n/a
 
      01-06-2008
On Jan 4, 4:47*pm, Paul Lalli <(E-Mail Removed)> wrote:
> On Jan 4, 9:16*am, Moti <(E-Mail Removed)> wrote:
>
> > Hi Guys,
> > After I got my indigoperl to work I want to build an application that
> > get data from the html textarea parse it and then return it to the
> > same text area (deleting the original text).
> > My parser returns a perl array (@output_array) which I want to print
> > to the html text area.
> > Where can I find an example on how to perfrom this ?

>
> perldoc CGI
>
> as an example...
> use CGI qw/:standard/;
> print textarea(
> * *-name=>'mytext',
> * *-rows=>10,
> * *-columns=>50,
> * *-default=>join('', @output_array)
> );
>
> Paul Lalli



Thanks for your answer Paul, but can I use the above example in order
to write to the same textarea I read from ?
Just to calrify - I dont want to create a new html document - I just
want to read the data from my existing html textarea, process it and
then write it back to the same form.

Another question if I may, It seems that there is a limition on the
size that I can read from my textarea ( I'm reading using the
$text_area_code = $cgi->param('text_area_data'); )
It seems that if the textarea contains more than 60 lines an error is
generated by the server.

Lots of questions I hope its OK.

Thanks, Moti.




 
Reply With Quote
 
Jürgen Exner
Guest
Posts: n/a
 
      01-07-2008
Moti <(E-Mail Removed)> wrote:

>Thanks for your answer Paul, but can I use the above example in order
>to write to the same textarea I read from ?


Without some trickery like client-side scripting or frames or refresh or
similar no. Once a page is rendered it is rendered. There is nothing the web
server can do to override the page content after it has been sent to the
client. This is a very fundamental design principle of http and has
absolutely nothing to do with Perl.

>Just to calrify - I dont want to create a new html document - I just
>want to read the data from my existing html textarea, process it and
>then write it back to the same form.


This is impossible by design of HTTP. Yes, there are ways to work around the
static nature of web pages but that is about web page programming and has
nothing to do with Perl.

>Another question if I may, It seems that there is a limition on the
>size that I can read from my textarea
>It seems that if the textarea contains more than 60 lines an error is
>generated by the server.


"An error" is about the worst possible description of a problem. _WHAT_
error message are you getting?
Always copy-and-paste, don't retype or paraphrase them. Or even worse don't
keep the text a secret.

jue
 
Reply With Quote
 
Uri Guttman
Guest
Posts: n/a
 
      01-07-2008
>>>>> "SB" == Scott Bryce <(E-Mail Removed)> writes:

SB> Jürgen Exner wrote:
>> Without some trickery like client-side scripting or frames or refresh or
>> similar no.


SB> Or AJAX.

what do you think ajax IS? it is client side scripting but just more
bundled up.

uri

--
Uri Guttman ------ http://www.velocityreviews.com/forums/(E-Mail Removed) -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
 
Reply With Quote
 
lihao0129@gmail.com
Guest
Posts: n/a
 
      01-07-2008
On Jan 6, 11:40*pm, Uri Guttman <(E-Mail Removed)> wrote:
> >>>>> "SB" == Scott Bryce <(E-Mail Removed)> writes:

>
> * SB> Jürgen Exner wrote:
> * >> Without some trickery like client-side scripting or frames or refresh or
> * >> similar no.
>
> * SB> Or AJAX.
>
> what do you think ajax IS? it is client side scripting but just more
> bundled up.


AJAX can surely handle this nicely without refreshing the whole page,
this is almost a basic AJAX applicaiton pattern. you can conduct a
'POST' instead of 'GET' HTTP method and send the texearea content back
to the server and then retrive the result from the client side. If you
get multiple fields to change on the client side, just use JSON from
both sides. I am using this approach to handle 'Preview' functionality
of my blog entry which is a textarea element and it worked pretty
well.

BTW. I am using HTML::Mason and JSON, no CGI::AJAX involved.

lihao(XC)
 
Reply With Quote
 
lihao0129@gmail.com
Guest
Posts: n/a
 
      01-07-2008
On Jan 7, 2:12*am, "(E-Mail Removed)" <(E-Mail Removed)> wrote:
> On Jan 6, 11:40*pm, Uri Guttman <(E-Mail Removed)> wrote:
>
> > >>>>> "SB" == Scott Bryce <(E-Mail Removed)> writes:

>
> > * SB> Jürgen Exner wrote:
> > * >> Without some trickery like client-side scripting or frames or refresh or
> > * >> similar no.

>
> > * SB> Or AJAX.

>
> > what do you think ajax IS? it is client side scripting but just more
> > bundled up.

>
> AJAX can surely handle this nicely without refreshing the whole page,
> this is almost a basic AJAX applicaiton pattern. you can conduct a


that means with AJAX you can refresh only the content in the
"textarea" element while all other HTML elements on the same page keep
untouched. all backend client-server interactions influence on only
this textarea element. (you can specify more fields to update for
sure..)

lihao(XC)

> 'POST' instead of 'GET' HTTP method and send the texearea content back
> to the server and then retrive the result from the client side. If you
> get multiple fields to change on the client side, just use JSON from
> both sides. I am using this approach to handle 'Preview' functionality
> of my blog entry which is a textarea element and it worked pretty
> well.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to add </textarea> within <textarea> tags? frank.moens@gmail.com Javascript 1 07-04-2007 04:00 PM
Problem - I want to print Current Output of Pdf file and should print once.I get print dialog box but it is not working keto Java 0 05-30-2007 11:27 AM
Textarea Inside of a textarea wperry1@gmail.com ASP General 6 02-05-2006 08:00 AM
Unlarging the print to print using PDF file to print Bun Mui Computer Support 3 09-13-2004 03:15 AM
Removing carriage returns from <textarea></textarea> input Augustus ASP General 1 09-10-2003 04:55 AM



Advertisments