Textarea value not getting posted with form

try to put it inside the form tag as follows… it should work <form action=”sendConfirmation.php” name=”confirmationForm” method=”post”> <textarea id=”confirmationText” class=”text” cols=”86″ rows =”20″ name=”confirmationText”></textarea> <input type=”submit” value=”Email” class=”submitButton”> </form> however you can use the same approach as well but you need to provide the from id attribute then <form action=”sendConfirmation.php” id=”confirmationForm” method=”post”> <input type=”submit” value=”Email” … Read more

Custom CSS to allow chrome textarea resize smaller than initial state?

These “min-height/min-width” rely on cols and rows attributes. Eg. if cols is missing or less than 1, its default value is 20, so the minimum width will be 20 characters width. (cf. http://www.w3.org/TR/html5/forms.html#the-textarea-element) The fact you cannot resize a textarea under its initial dimensions is reported as a bug (https://code.google.com/p/chromium/issues/detail?id=94583) although The user agent may … Read more

How to count the number of lines in a JTextArea, including those caused by wrapping?

You can use LineBreakMeasurer Class. The LineBreakMeasurer class allows styled text to be broken into lines (or segments) that fit within a particular visual advance. This is useful for clients who wish to display a paragraph of text that fits within a specific width, called the wrapping width.LineBreakMeasurer implements the most commonly used line-breaking policy: … Read more

Enter key in textarea

You could do something like this: <body> <textarea id=”txtArea” onkeypress=”onTestChange();”></textarea> <script> function onTestChange() { var key = window.event.keyCode; // If the user has pressed enter if (key === 13) { document.getElementById(“txtArea”).value = document.getElementById(“txtArea”).value + “\n*”; return false; } else { return true; } } </script> </body> Although the new line character feed from pressing enter … Read more

How do I make a textarea an ACE editor?

As far as I understood the idea of Ace, you shouldn’t make a textarea an Ace editor itself. You should create an additional div and update textarea using .getSession() function instead. html <textarea name=”description”/> <div id=”description”/> js var editor = ace.edit(“description”); var textarea = $(‘textarea[name=”description”]’).hide(); editor.getSession().setValue(textarea.val()); editor.getSession().on(‘change’, function(){ textarea.val(editor.getSession().getValue()); }); or just call textarea.val(editor.getSession().getValue()); only … Read more

How to select line of text in textarea

This function expects first parameter to be reference to your textarea and second parameter to be the line number function selectTextareaLine(tarea,lineNum) { lineNum–; // array starts at 0 var lines = tarea.value.split(“\n”); // calculate start/end var startPos = 0, endPos = tarea.value.length; for(var x = 0; x < lines.length; x++) { if(x == lineNum) { … Read more