cancel
Showing results for 
Search instead for 
Did you mean: 

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

raj44
Participant
0 Kudos

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...

Thanks,

Rajeev

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

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.

Thanks

Anshul

raj44
Participant
0 Kudos

Hi Anshul,

Thanks for the reply.... how do I go about encoding the url parameters....i have never done that....can you please explain in more detail...

one more question:

IF i enable tab key functionality in textarea using Jquery...will it serve my purpose?

Former Member
0 Kudos

HI Rajeev,

Use escape function in javascript to encode the value of textarea. Like

     value = escape(document.getElementById("myTextarea").value)

Use value to construct the url.

I am not sure this problem can be solve via jquery also.

Thanks

Anshul

Former Member
0 Kudos

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 =.