Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

I'm using this code to put breaklines in asp:textbox, but the thing i don't like is, that when i edit the data, the br are seen.

 

<script type="text/javascript">
<!--
   function changeTextBoxValue(elementRef) {
       var textBoxValue = elementRef.value;

       while (true) {
           var currentValue = textBoxValue;

           textBoxValue = textBoxValue.replace('\n', '<br />');

           if (textBoxValue == currentValue)
               break;
       }

       elementRef.value = textBoxValue;
   }
// -->
</script>

 

does anyone has a better code and that are saved in db, but if you edit the data text will be in next line but without <br>

  • 2 weeks later...
Posted
Can you not simply run the replace code only when you output the data from the database? So it will be stored in your db as \r\n or whatever, but before you output the data you replace that value in the string you fetched from the db.
Anybody looking for a graduate programmer (Midlands, England)?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...