The HTML:



And on the server side, we have a subroutine within a Perl script which looks like: sub sendchatmessage { my $self = shift; # Retrieve the text message sent to us from the browser my $chatmsg = $self->OP->param->get_incoming('fields')->{'newtext'}; # Perhaps we want to log all messages log_message( $chatmsg ); # Get the last 10 messages which have been sent to # the chat server (including the one we just logged) my $messages = get_last_ten(); # Prepare to send data back to the browser. # Each hash key represents a field in our HTML my $field_data = { chatwindow => $messages, # Put the last 10 messages in the chat window newtext => "", # Blank out the newtext field }; # Send the data back to the browser. # This puts the appropriate data into the browser, # and puts the focus on the newtext field return $self->param('OpenThought')->serialize({ fields => $field_data, focus => "newtext", }); }