Skip to Content
avatar image
Former Member

problem in passing a string from a textarea to the URL calling transaction

I am passing a long string data with spaces through a textarea in html to a stored procedure which will update the records.

The spacing in between the string(meaning columns) for one row is just only one tab (“\t”). The rows are separated by two spaces, one for carriage return(char13) and line feed char(10).

Can you guys please help me with the appropriate CSS for text area which will consider these space requirements (tabs, carriage return and line feed char)?

I am passing this string as an input parameter to the transaction by calling a url through a ajax call. The problem is that the formatted string is passed as a whole ignoring the spaces which is giving me the errors. So basically the string gets altered before it is sent to the url. How do I ensure that the string which is passed to the url doesn't get changed..and is passed as it is?

My textarea code is like:

<textarea rows:"20" cols:"120"> </textarea>

will dimensions affect the spacing ? And if so, could you please also help me in designing the appropriate dimensions that include these defined spaces?

I have also read on net about the white-space CSS property but did not exactly understand how to incorporate that...



Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Jul 30, 2012 at 09:51 AM

    Hi Rajeev,

    Please check ajax url paramenter passing on the web for your problem. This problem has nothing to do with CSS or Textarea element.

    Make sure you are encoding the URL parameters before sending it to ajax call. It will preserve the spaces of url parameters.



    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      URL Encoding means taking special characters (Or really any characters) and turning them into their hex values and add a % sign before them.

      For example the carriage return \r is 0D in hex so the URL encoding will be %0D.

      The new line feed \n is 0A in hex so the URL encoding will be %0A.

      If you want to know what the hex or even decimal value is for a character google ASCII table.

      When you take the value out of the text area do a string replace on '\r\n' and replace it with '%0D%0A'.

      Not sure what the hex value for tab is but you can apply this principle to it al well.

      Note: You might want to sanitize the input by URL encoding URL special characters like ? & and =.