TextArea

Im working on my own textarea component and I have
few problems.
How should I implement word wrapping? Currently Im using StringTokenizer to get spaces and periods etc. Is there more efficient way to do it?
My solution for word wrapping works but it is pretty slow and I would be glad if someone has some ideas how to do it.
dr sykero

Check out the classes in the java.text and java.awt.font packages. A BreakIterator may be what you need.

Similar Messages

  • Questions on the features of a textarea.

    Hi experts,
    I am working on Documaker 12.0.1. I have some doubt related to the feature of a textarea mentioned below. Could you please put a light on it ?
    _1. Sizing_
         a- Can grow and shrink
         b- Can span pages
         c- Must fit on page
         d- Suppress variable lines
         e- Adjust top line
    _2.Default (fonts)_
         a- Tab stops
    I am having some problem while creating a fap. I have 2 textareas in a fap and separated by some space, when I am seeing the output the whole fap is going to second page, although it is having enough space to print in the first page itself. For some case when I am unchecking the ADJUST TOP LINE and checking CAN GROW AND SHRINK, its coming in first page. fap is auto sized also. When I am minimizing the space between two textareas to print in first page, its overlapping. Please let me know if you need any more information..
    Thanks,
    Bikas Ranjan

    You mention multiple options that can affect the result in numerous ways. For instance, 'Must fit' means that the text area must fit on a page if it can. So even with the can span turned on, the text might move as an entirety to the next page if it can't stay as a whole on the first page.
    Also note that with multiple text areas on a page, only the one text area that is formatting is allowed to split during that format. That means if you put two text areas one above the other and then make the top one grow, the bottom text area is "pushed". And if it encounters the bottom of the page, that text area will go to the next page - even if you had the split option on that one too. This behavior is not normally a problem when you consider that sections are mapped from top to bottom, but if you are using a different order or unusal sized items, it can get in the way.

  • Losing carriage returns in textarea / using plpdf to generate report

    Hello,
    I'm using Apex 3.1.1 and Oracle 10g database. I would appreciate any suggestions on how I can preserve carriage returns in a textarea when sending the text to a package that generates a report. Please see example of current problem (below code). I'm using an onkeypress function to check for keycode = 13 when the Enter key is pressed -- that is working. I also created an alert to show the url value -- I can see the text on multiple lines, so that appears to be working as well. The textarea value parameter in the package is defined as varchar2. Per the support folks at plpdf.com, chr(13) indicates an explicit line break, and they told me to check my text. I don't know what I'm missing. Thank you for any suggestions you may have.
    Lisa
      function callPLPDFRep()
          var url;
          url = '#OWNER#.' + $x('P&APP_PAGE_ID._REPORT_PROCEDURE').value + '?' + build_params();
          w = open(url, "winPDFRep", "Scrollbars=1, resizable=1, width=800, height=600");
          if (w.opener == null)
            w.opener = self;
            w.focus();
       function build_params()
        var lparms;
        lparms = '';
        lparms = lparms + '&p_incorrect=' + $x('P212_INCORRECT').value;
        lparms = lparms + '&p_correct=' + $x('P212_CORRECT').value;
        return lparms;
      }Text in textarea:
    035 5768 06/15/2010
    035 5768 06/16/2010
    035 5768 06/17/2010
    Printout on report:
    035 5768 06/15/2010035 5768 06/16/2010035 5768 06/17/2010

    Hello Michael,
    Thank you for your response. After doing some researching and experimenting, here's what I have found so far.
    First, using an onkeypress function to alert the keycode, a chr(13) is being returned when I press the Enter key in the textarea.
      function check_Enter(e)
        var keynum;
        var textval = $x('P212_INCORRECT').value;
        if(document.all) 
          keynum = e.keyCode
        else
          keynum = e.which
        alert(keynum);     
      }Next, when I access the value of the textarea via javascript with $x('P212_INCORRECT').value, the chr(13) is automatically converted to the newline character (\n). In an attempt to replace the \n with a \r so plpdf will recognize the carriage return, I added a javascript replace function before sending the text to the package, and it does not work.
      function build_params()
        var lparms;
        lparms = '';
        lparms = lparms + '&p_incorrect=' + $x('P212_INCORRECT').value;
        lparms = lparms + '&p_correct=' + $x('P212_CORRECT').value;
        alert(lparms.split(/\n/g).length - 1);  // confirm that a newline character is found
        lparms = lparms.replace( new RegExp( "\n", "g" ), "\r");  // replace newline character with carriage return
        return lparms;
      }When I tried to replace the newline character (\n) with chr(13), the chr(13) is printed out like it is text instead of a special character. In order to test that I have the correct syntax for the replace function in javascript, I tried replacing \n with '...', and then in the package that generates the PDF, I replaced the '...' with chr(13). That works!
    In response to your comment about the PLPDF procedure for multi line section, I am using: plpdf.PrintMultiLineCell(180, 6, l_incorrect, '0', 0). As a newbie to javascript, I am not sure why replacing \n with \r is not working. Can you advise how to use a chr(13) in the javascript replace function and have it recognized as a special character and not text? I don't know how to view special characters in the textarea other than checking for them with javascript.
    Thanks, Lisa

  • How to use the nl2br() function - or addressing textarea formatting issues

    the textarea does not pass line breaks to mysql - the result in the html output is one long string of text. I would like the user to input into the textarea using the enter key to create new paragraphs.
    I am not a php programmer and rely on the dreamweaver data tools and developer tool kit to create my dynamic content.
    Please send sample code for a form that addresses and corrects this issue. I do not know how/where to modify the code to correct this issue.
    I have searched online but nowhere have I found an example of how to actually write the code. I can do a great deal of manual modification of php code but this one has me stumped for some reason..
    thanks in advance !!!!
    here is the index.php code which contains the form:
    PHP:
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
      $insertSQL = sprintf("INSERT INTO tw_responses (id, tweet, response, permalink) VALUES (%s, %s, %s, %s)",
                           GetSQLValueString($_POST['id'], "int"),
                           GetSQLValueString($_POST['tweet'], "text"),
                           GetSQLValueString($_POST['response'], "text"),
                           GetSQLValueString($_POST['permalink'], "text"));
      mysql_select_db($database_twitter, $twitter);
      $Result1 = mysql_query($insertSQL, $twitter) or die(mysql_error());
      $insertGoTo = "QA.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
      header(sprintf("Location: %s", $insertGoTo));
    mysql_select_db($database_twitter, $twitter);
    $query_Recordset1 = "SELECT * FROM tw_responses";
    $Recordset1 = mysql_query($query_Recordset1, $twitter) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    $totalRows_Recordset1 = mysql_num_rows($Recordset1);
    ?>
    <?php $rs = mysql_fetch_array($resultsetquery);
    $string = nl2br($rs['response']);
    echo($string); ?>
    FORM:
    <form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
                    <table width="461" align="center" cellpadding="4" cellspacing="4">
                      <tr valign="baseline">
                        <td width="71" align="right" nowrap="nowrap">Question:</td>
                        <td width="360"><input type="text" name="tweet" value="" size="50" /></td>
                      </tr>
                      <tr valign="baseline">
                        <td nowrap="nowrap" align="right" valign="top">Answer:</td>
                        <td><textarea name="response" cols="50" rows="15"></textarea></td>
                      </tr>
                      <tr valign="baseline">
                        <td nowrap="nowrap" align="right"> </td>
                        <td><input type="submit" value="Insert record" />
                        <input type="reset" name="Reset" id="button" value="Reset" /></td>
                      </tr>
                    </table>
                    <input type="hidden" name="id" value="" />
                    <input type="hidden" name="MM_insert" value="form1" />
                  </form>
    Here is QA.php code which contains the output:
    PHP
    <?php require_once('../Connections/twitter.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $maxRows_Recordset1 = 10;
    $pageNum_Recordset1 = 0;
    if (isset($_GET['pageNum_Recordset1'])) {
      $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
    $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
    mysql_select_db($database_twitter, $twitter);
    $query_Recordset1 = "SELECT * FROM tw_responses ORDER BY id ASC";
    $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
    $Recordset1 = mysql_query($query_limit_Recordset1, $twitter) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    if (isset($_GET['totalRows_Recordset1'])) {
      $totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
    } else {
      $all_Recordset1 = mysql_query($query_Recordset1);
      $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
    $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;$maxRows_Recordset1 = 10;
    $pageNum_Recordset1 = 0;
    if (isset($_GET['pageNum_Recordset1'])) {
      $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
    $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
    mysql_select_db($database_twitter, $twitter);
    $query_Recordset1 = "SELECT * FROM tw_responses ORDER BY id DESC";
    $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
    $Recordset1 = mysql_query($query_limit_Recordset1, $twitter) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    if (isset($_GET['totalRows_Recordset1'])) {
      $totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
    } else {
      $all_Recordset1 = mysql_query($query_Recordset1);
      $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
    $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
    ?>
    OUTPUT:
    <?php do { ?>
      <table width="95%" border="0" cellpadding="4" cellspacing="2">
        <tr>
          <td><a name="<?php echo $row_Recordset1['id']; ?>"></a></td>
        </tr>
        <tr>
          <td><p><strong><em>Question: </em></strong><a href="http://www.halopets.com/test/admin/QA.php#<?php echo $row_Recordset1['id']; ?>"><?php echo $row_Recordset1['tweet']; ?></a></p></td>
        </tr>
        <tr>
          <td><p><strong><em>Answer: </em></strong><?php echo $row_Recordset1['response']; ?></p></td>
        </tr>
        <tr>
          <td><hr width="95%" size="1" noshade="noshade" /><br /></td>
        </tr>
      </table>
      <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>

    twinflame wrote:
    the textarea does not pass line breaks to mysql - the result in the html output is one long string of text. I would like the user to input into the textarea using the enter key to create new paragraphs.
    I am not a php programmer and rely on the dreamweaver data tools and developer tool kit to create my dynamic content.
    Please send sample code for a form that addresses and corrects this issue. I do not know how/where to modify the code to correct this issue.
    http://tinymce.moxiecode.com/

  • Relative image path for image in textarea

    I am trying to include an image into my textarea in my
    Main.mxml file. The images fail to load, what is wrong with my
    path?
    My folder structure's is like this
    scr->
    _____Main.mxml
    _____images->
    _____________green-grass.jpg

    Actually when I ran the program it worked fine, the only
    problem was in the flex design view

  • What would be the best way to use a list in a textarea to compare to values in a column in a database table?

    I'm trying to move a table from a MS Access database to a datasource online so I don't have to be the only one that can perform a specific task.
    Right now I regularly am having to assess change requests to determine if it impacts the servers my team supports.  Currently I copy and paste the text list into a temporary table in MS Access then hit a button to run a query comparing what was in that list to my server inventory.  Works fine but now I need to move this online so others can do this in a place where we can also keep everyone using the exact same inventory and am planning on using a ColdFusion server.
    So what I believe would be easiest is to create a form that has a textarea where I can just copy and paste what is in the change request and then hit a submit button and go to the next page where it would list all the servers that matched (with all the other info I also need).
    Almost always the info would hit the textarea with a separate row for each server with no other delimiters, etc.
    Example info in textarea:
    servername1
    servername2
    servername3
    What is the best/easiest way in the SQL code on the following page to take the values from the textarea the way they are listed and return results of any that match the server name column from that list?  What CF functions and SQL coding are needed?
    I've done something in the past where I did WHERE Server IN (#PreserveSingleQuotes(Form.ServerList)#)...
    But I had to input 'servername1', 'servername2', 'servername3' in the text box and with how often we'll be copying lists as show above from a text area or from an excel column I'd really like a way to get from the example above to the results I need without having to manipulate.  Sometimes the list I'm comparing against may be 300+ servers and adding that formatting is not desirable.
    Any help would be appreciated.

    So here is a solution I came up with
    <cfoutput>
    <cfset Servers="#StripCR(Form.ServerList)#">
    <cfset Servers2="'#Replace(Servers, "
    ", " ", "All")#'">
    <cfset Servers3="#ToString(Servers2)#">
    <cfset Servers4="#Replace(Servers3, " ", "', '", "All")#">
    </cfoutput>
    Then in the cfquery SQL I used
    WHERE Server IN (#PreserveSingleQuotes(Servers4)#)
    Right now this is working but it seems very cumbersome.  If anyone can come up with a way to simplify this please let me know.

  • Textarea does not work in android!!

    Hello. I need to place a multiline text area for the user to enter and remain in memory. I'm using a "textarea: within a" form "in html5. Everything works fine on iPad, when I test it in Android, the keyboard is not activated.
    I am new in Digital Publishing Suite and I'm doing my first project. I would greatly appreciate if you could help me. I have several days of searching and answer and I exhausted my options. I am working in INDesignCS6 and the tablet i am using to text has Android OS, 4,04

    kmolina, the issue might be the z index not being onfocus or there might be divs overlapping the text area which would prevent the keyboard to appear but still show the text area to be on focus.
    This is also a known issue for Android OS.
    There is a similar discussion at http://stackoverflow.com/questions/3460915/webview-textarea-doesnt-pop-up-the-keyboard where they provide some workarounds.
    This link also has info on text area in Android: http://developer.android.com/guide/topics/ui/controls/text.html
    If those tips do not solve the issue I recommend contacting your Gold support to be investigated by a technical support engineer.

  • On Windows 8.1 and Firefox 36.0.1 the textarea in forms has no carriage returns. Earlier versions the forms work. Is there a fix for this?

    Prior to this version of Firefox 36.0.1, the <textarea> in my HTML forms was working; displaying carriage returns. In version 36.0.1 they no longer function properly. Instead when I enter a carriage return, it displays a space instead of a newline. I went to the most basic textarea testing
    &lt;textarea&gt; name="comments" cols=20 rows=10 &lt;/textarea&gt;
    to make sure I wasn't introducing anything with other languages.
    I am using Windows 8.1 Pro. I rolled back to Firefox 35.0 and everything works fine. I install 36.0.1 and it stops working.
    I have access to another Laptop also running the same version of windows and Firefox and it appears to be doing strange things as well. I am suspicious in that I started noticing this immediately after a windows upgrade last night. The laptop also experienced the issues it is having immediately after a windows update yesterday evening.
    I have yet another PC running a different version of windows and Firefox and it too works fine. It looks like the issue is where there is windows 8.1 Pro and Firefox 36.0.1.
    Do you guys have any idea what is going on here?
    Thanks
    JMRAUPE57

    The current release supports the white-space property for a text area and it is possible that the website uses white-space: pre instead of white-space: pre-wrap.
    The former will prevent Firefox from wrapping the text.
    You can check that in the Inspector via the right-click context menu.
    *https://developer.mozilla.org/Tools/Page_Inspector
    See:
    *https://developer.mozilla.org/en-US/Firefox/Releases/36#CSS
    <blockquote>The white-space property is now working on <textarea> HTML elements (bug 82711).</blockquote>
    See also:
    *[[/questions/1050456]] Word wrap problems in 36.0

  • Highlighting text in TextArea

    How do I highlight selected text in TextArea? (awt)
    For example, I am using the StringTokenizer class to break up the text into words and wish to highlight any mis-spelt words.
    Thanks again,
    Sean

    TextArea inherits the method select() from TextComponent. This allows a single selection within the TextArea by specifying the start and end positions. There isn't a way to have multiple selections in a TextArea.

  • How do I get marked text (text marked in a textarea with mouse)

    Hi.
    I want to implement a method that saves marked text in a textarea in a string. With marked text I mean text that the user marked with its mouse. Is there a method already in the JAVA library?
    Yours
    RB

    Sorry, my fault. Just had a glance in the JAVA API Specification ;)
    Didn't know that DefaultEditorKit is part of the JAVA library.
    RB

  • Using Squiggly with Spark TextArea causes TLF formatting to disappear

    We are using a Spark TextArea component in our application to offer more enhanced text formatting options to our users. Yesterday we downloaded Squiggly since it's the only one available that seems to support the spark components. It is highlighting misspelled words correctly and does have a nice right-click context menu with suggestions, etc. However, when we select a word from the suggestion list and it replaces it in the text area, it seems to replace the entire contents of the textarea as plain text. Any formatting on the text such as bold, italics, font sizes, underlines, all immediately disappear once the misspelled word is replaced. We're using the SpellUI implementation. Below is some of the snippets of the code we're using to implement SpellUI:
    protected function createTextArea():void {
      _textArea = new TextArea();
      _textArea.editable = true;
      _textArea.enabled = true;
      _textArea.textFlow = TextConverter.importToFlow(XML(dataModel.value)[0], TextConverter.TEXT_LAYOUT_FORMAT);
      _textArea.textFlow.flowComposer.updateAllControllers();
      _textArea.addEventListener(FlexEvent.CREATION_COMPLETE, setupSpellCheck, false, 0, true);
    private function setupSpellCheck(event:Event=null):void {
      logger.debug("setupSpellCheck", "Setting up spell check system...");
      _textArea.removeEventListener(FlexEvent.CREATION_COMPLETE, setupSpellCheck);
      resourceManager.localeChain = [localeStr];
      enableSpellCheck();
      enableSpellCheckContextMenu();
    private function enableSpellCheck():void {
      SpellUI.enableSpelling(_textArea, localeStr);
    private function enableSpellCheckContextMenu():void {
      var contextMenu:Object = {add:resourceManager.getString('SquigglyContextMenu', 'add'),
                                             enable:resourceManager.getString('SquigglyContextMenu', 'enable'),
                                             disable:resourceManager.getString('SquigglyContextMenu', 'disable')};
      SpellUI.setSpellingMenuEntries(contextMenu);
    As you can see, we're constructing a new TextArea control and setting it's textFlow by importing an existing textflow XML that we have saved in our database. Once the TextArea has dispatched the FlexEvent.CREATION_COMPLETE, we are setting up the spell check system and everything works ok until you actually correct a misspelled word by selecting it from the right-click suggestions list. The text initially imported may have any number of styles applied to it as I mentioned above. Once the spelling replacement occurs, all the formatting is wiped out for the entire text area.
    Any thoughts?
    -Jason Kringen

    Just to give some more details, here's the TextFlow output from our TextArea before using the spell check word replacement:
    <TextFlow columnCount="inherit" columnGap="inherit" columnWidth="inherit" lineBreak="inherit" paddingBottom="inherit" paddingLeft="inherit" paddingRight="inherit" paddingTop="inherit" verticalAlign="inherit" whiteSpaceCollapse="preserve" xmlns="http://ns.adobe.com/textLayout/2008"><p direction="ltr" justificationRule="auto" justificationStyle="auto" leadingModel="auto" paragraphEndIndent="0" paragraphSpaceAfter="0" paragraphSpaceBefore="0" paragraphStartIndent="0" textAlign="start" textAlignLast="start" textIndent="0" textJustify="interWord"><span>Text goes in here. </span><span alignmentBaseline="useDominantBaseline" backgroundAlpha="1" backgroundColor="transparent" baselineShift="0" breakOpportunity="auto" cffHinting="horizontalStem" color="#000000" digitCase="default" digitWidth="default" dominantBaseline="auto" fontFamily="Arial" fontLookup="embeddedCFF" fontSize="28" fontStyle="normal" fontWeight="bold" kerning="auto" ligatureLevel="common" lineHeight="120%" lineThrough="false" locale="en" renderingMode="cff" textAlpha="1" textDecoration="none" textRotation="auto" trackingLeft="0" trackingRight="0" typographicCase="default">misspeled</span><span> jhkjd het </span></p></TextFlow>
    And here is the TextFlow output immediately after replacing a misspelled word:
    <TextFlow columnCount="inherit" columnGap="inherit" columnWidth="inherit" lineBreak="inherit" paddingBottom="inherit" paddingLeft="inherit" paddingRight="inherit" paddingTop="inherit" verticalAlign="inherit" whiteSpaceCollapse="preserve" xmlns="http://ns.adobe.com/textLayout/2008"><p><span>Text goes in here. misspeled jhkjd get </span></p></TextFlow>
    So it's obviously stripping out all of the TLF formatting and simply leaving the blank <p> and <span> tags without any of the formatting details.

  • Getting values from TextArea(html)

    let's say I have two files. page1.jsp and page2.jsp.
    in page1.jsp I have a textarea with name="tArea", a button which will submit TextArea information to page2.jsp as parameters.
    on page2.jsp I will get that value that is being passed and I will print it out via String strTArea = request.getParameter("tArea");out.println(strTArea );
    The problem comes when the parameter passed involves "carriage return" and "line feed". I can verify on the address bar that the parameter passed has the correct amount of "enters". but when I get the value via "request.getParameter()", the data is malformed turning "enters" into mere spaces.
    (enter = line feed + carriage return)
    So, anyone has encountered the same problem? Might want to help me out because I need the correct data from that parameter. Any ideas are welcome.

    I will consider this topic solved.
    with the help of:
    http://forums.sun.com/thread.jspa?forumID=45&threadID=705997

  • Problem with data selection when inserted through textarea

    hi there,
    i am inserting data from textarea into a database field
    and then displaying the inserted data it is displaying properly but as a continuous string
    i want to display it as it was inserted with new line
    like if i have inserted through <textarea>
    hello
    all
    there
    it is displaying like
    hello all there
    i want to display as it was
    i have three pages as given below and my database field is varchar (using oracle 9i)
    1.first.html
    <html>
    <body>
    <form method="post" action="insert.jsp">
    <textarea name="text">
    </textarea>
    <input type="submit"></input>
    </form>
    </body>
    </html>2.insert.jsp
    <%@ page import = "java.io.*"%>
    <%@ page import="java.sql.*" %>
    <%!
    String txt;
    %>
    <%
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         Connection con =DriverManager.getConnection("jdbc:odbc:ods","scott","tiger");
         txt= request.getParameter("text");
         out.println(txt);
         PreparedStatement ps = con.prepareStatement("insert into text values('"+txt+"')");
         ps.executeUpdate();
         out.println("values inserted successfully");
    %>3.display.jsp
    <%@ page import = "java.io.*"%>
    <%@ page import="java.sql.*" %>
    <%
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         Connection con =DriverManager.getConnection("jdbc:odbc:ods","scott","tiger");
         PreparedStatement ps = con.prepareStatement("select * from text");
         ResultSet rs=ps.executeQuery();
         while(rs.next())
         out.println(rs.getString(1));
    %>thanx & regards
    sweety

    This is a feature of HTML. Its the way it is supposed to work.
    If you view source on your generated jsp page, you should see the html exactly mirrors what you typed in the text area
    If you don't want it acting this way then either
    1 - put it in a text area again
    2 - put <pre> tags around what you want do display unformatted
    or
    3 - Change all new lines to <br> in the html
    This is what you want in the html:
    <pre>
    Mulitple
      line
    Data
    </pre>

  • Problem with HTML in a read only textarea item

    I'm working on a messaging system for our site. For the body of the message, we use a standard textarea item. However, if we come to the messaging page from a certain page in our system, then we pre-load the textarea item, and make it read only. The only problem with this is that there are HTML tags in the body that we try to pre-load. This is causing problems because they aren't being interpreted as tags, but are being displayed as text. If I make the textarea editable, then everything looks fine, it's just when I set the area to be read only that it doesn't work. Any thoughts on how to fix this? Thanks!

    Not always. A user is allowed to edit that area in most circumstances except for when the user arrives at the page coming from 1 page in particular. In this case, then the field is read-only. At all other times though, it is editable.
    As a workaround, whenever I know I'm coming from this page, I set a variable, and if the variable is set, then I use a Display Only item and then hide the Textarea. If the variable is not set, then I hide my Display Only item and show the Textarea. Not very elegant, but it works.

  • How to get selected text values in a textarea by mouse click?

    Hi Everyone,
    What I am trying to do is to click on some texts in a textarea, then get the selected text value.
    If you guys have used an accounting software called Simply Accounting, you might understand better.
    I list all my customer names in a textarea. What I want is, when I click on one customer, another GUI pops up with this customer's information. My problem is that I don't know how to get the selected text value from a textarea.
    Could anyone give a hand here? Thank you in advance.

    Is there some reason you aren't using a JList or
    JTable to display
    the user names/information?Thank you for es5f2000's reply. You just gave me a better idea! There is not a particular reason I have to use TextArea to list my customers. As long as the component can make my idea alive, I definitely use it. Still, if there is any way to get a selected text value, it will help me a lot with my project. Thank you.

  • How to set background color for textarea

    Hi all,
    I have created an application in Apex 3.2.
    I am now able to disable the text fields, select lists and textarea.
    Ex:
    function disableDD()
      var v_ddays              = document.getElementById("P2_DELINQUENCY_DAYS");
      v_ddays.value            = "";
      v_ddays.disabled         = true;
      v_ddays.style.background = '#cccccc';
    }The background color thing is working for all the text fields, but the same is not working with the textarea.
    Any help please....

    There is no button involved in the following code, but it may
    be of use to you:
    <?xml version="1.0"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    creationComplete="init()">
    <mx:Script>
    <![CDATA[
    private var origColor:uint;
    private function init():void {
    origColor = dc.getStyle("selectionColor");
    public function setBackGrdColors(newColor:uint):void {
    dc.setStyle("selectionColor", origColor);
    if(dc.selectedDate){
    var dayOfWeek:Number = dc.selectedDate.day;
    else{
    return;
    switch(dayOfWeek) {
    case 0:
    if(sun.selected)
    dc.setStyle("selectionColor", newColor);
    break;
    case 1:
    if(mon.selected)
    dc.setStyle("selectionColor", newColor);
    break;
    case 2:
    if(tue.selected)
    dc.setStyle("selectionColor", newColor);
    break;
    case 3:
    if(wed.selected)
    dc.setStyle("selectionColor", newColor);
    break;
    case 4:
    if(thu.selected)
    dc.setStyle("selectionColor", newColor);
    break;
    case 5:
    if(fri.selected)
    dc.setStyle("selectionColor", newColor);
    break;
    case 6:
    if(sat.selected)
    dc.setStyle("selectionColor", newColor);
    break;
    default:
    break;
    ]]>
    </mx:Script>
    <mx:VBox horizontalAlign="center" verticalGap="20">
    <mx:DateChooser id="dc" textAlign="left"
    change="setBackGrdColors(cellColor.selectedColor)"/>
    <mx:HBox width="100%" horizontalAlign="center">
    <mx:CheckBox id="sun" label="Sun"/>
    <mx:CheckBox id="mon" label="Mon"/>
    <mx:CheckBox id="tue" label="Tue"/>
    <mx:CheckBox id="wed" label="Wed"/>
    </mx:HBox>
    <mx:HBox width="100%" horizontalAlign="center">
    <mx:CheckBox id="thu" label="Thu"/>
    <mx:CheckBox id="fri" label="Fri"/>
    <mx:CheckBox id="sat" label="Sat"/>
    </mx:HBox>
    <mx:HBox width="300" horizontalAlign="center">
    <mx:Label text="Background Color" />
    <mx:ColorPicker id="cellColor"
    selectedColor="#FF00FF"/>
    </mx:HBox>
    </mx:VBox>
    </mx:Application>

Maybe you are looking for

  • I can't see the double arrows to access to full screen mode

    I have a imac (the pretty big one) with OS 10.7 and i can't see the double arrows to access to full screen mode in any application. Even Safari or other native software don't work. Did anyone have a clue for me please ? The combiantion Ctrl-Cmd-F doe

  • Comparisons of Duration, Date and Time Values

    Hello, Is there way to simulate support for XPath 2.0 date/time comparison functions? (can I create a module to replace currently available XPath functions with my own?) Are there plans to fully support those functions? For example: func-date-less-th

  • Re-connect to source file

    I'm new to the mac world and I mucked something up in the data transfer and now nearly all my songs in itunes have the ! sign saying that I need to reconnect to the source file. I can't possibly do this for 10k+ songs. How do I have iTunes reconnect

  • Escaped characters & in LSO Test player after LSO 600 upgrade

    Hi All, We were told that we wouldn't have top touch courses or tests after the LSO 300-600 upgrade. We have found special chars like & showing up as & in test questions. Has anyone else seen this? We submitted a message but got no satisfaction from

  • Connecting External WebServices

    Hello All: I am trying to connect external webservices, but running into same issue time and again. When running a testcase, the result produces is as below. I am trying to connect to a free on the internet currency converter webservice at www.webser