FAQ Database Discussion Community


How to access clipboard and current cursor position when pasting in a textarea in IE8/9 before it becomes the current value?

javascript,internet-explorer-8,internet-explorer-9,textarea,maxlength
Since IE8/9 do not support HTML5's maxlength attribute, I need to find a way to prevent pasting too long text into a textarea/input, so I chose to go with the onpaste-attribute/eventhandler via jQuery, see the example code below: $(document).ready(function() { $('textarea[maxlength]').on('paste', function() { var maxlength = $(this).attr('maxlength'); if (this.value.length >=...

Display two columns data in textarea using table PHP

php,mysql,table,textarea
I am trying to display the data from two columns in a database table inside a textarea in php, under the headings tag number and scc It should read something like this. However it reads all in one line with no breaks and it looks messy. Here is my code,...

Textarea input length check in JavaScript

javascript,forms,validation,textarea
I'd like to create an SMS gateway which alerts the user each time when 160 chars are written (or pasted). I need to store a variable n containing number of message parts of 160 chars. The code will be like this, just the n needs to be stored globally. Is...

JavaFX TextArea get caret position from coordinate

java,javafx,textarea,javafx-8
Is it possible to get the caret position (an int) at a screen coordinate (2 double) in JavaFX TextArea?

Update form validation on right-click cut/paste

javascript,jquery,html,textarea,string-length
I check the length of user input to give feedback before they attempt to submit the form. Here's my code: var $foo = $("#foo"), $span = $("span") $foo.on('keydown keyup change', function(){ $span.text($foo.val().length); }).trigger('change'); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <textarea id="foo">Ipsum</textarea> <small><span></span> characters.</small> This works correctly for input typed. However, if a user cuts...

Print text in html textarea tag

php,html,textarea
I have a page that collects data from a database then prints it into another form so the user can update it. It works with the input box, but not the textarea box. Here is the code in the form: <textarea id="description" name="description" value="<?php echo $row['description'];?>"> </textarea> I'm pretty sure...

Pointers about resizing text area

javascript,regex,textarea
Need some help/pointers.... When the user will click on a p element i want it content to be displayed in an text area so it would be possible to modify the text and etc... The text area will be of a fixed width.Thus when the last character will be at...

dojo Grid renderCell Textarea

dojo,textarea
I'm trying to create a grid from json data. Each cell will be editable eventually. One column contains type dependant data and based on the type I want to show either a pair of date pickers (start/end date) or Textarea or some other widget. I'm using renderCell to attempt to...

Compare submitted textarea with initial value

php,html,textarea
I want to output an array (from a text-file) into a textarea, let users change it and afterwards save that array back to the text-file. <textarea name="text"><? echo(html_entity_decode(implode("\n", $array))) ?></textarea> Before the array gets stored back to the text-file, I want to make sure, that actually something was changed. if...

how to prevent unclearing a textbox when selection is made?

javascript,onclick,textarea,selection
I'm trying to build a texteditor and for that I'm using a textarea to fill in my text My problem is when I click a button the textarea selection is gone. Here is some code to show the problem: <!DOCTYPE html> <html> <body> Address:<br> <textarea id="myTextarea"> California Road </textarea> <p>Click...

Is there any way to set maximum length constraint on each row of a textarea field?

html,textarea
I need to fulfill a unique requirement from my client. Attached here is the image, I need to force the user not to enter more than 15 digits per row of a <textarea> field without any spaces. Is this possible with HTML? I thought of using cols attribute but then...

Extra line breaks with simple_format

ruby-on-rails,ruby,textarea
To practice Ruby on Rails, I am creating a blog which includes a text area (following Mackenzie Child's tutorial). Unfortunately, line breaks are included every time I press enter. How can I remove the extra line breaks? show.html.erb <h1><%= @post.title %></h1> <p><%= simple_format(@post.body) %></p> _form.html.erb <div class="form"> <%= form_for @post...

Asp.net textarea add empty string to the value [closed]

c#,asp.net,webforms,textarea
I have the textarea inside repeater <textarea class="form-control" disabled="disabled" > <%#Eval("value") %> </textarea> and when it's have value appear to have empty string in front and end of my string value Empty string in the inspector How to remove the empty string in front and end of the value (Trim)...

How to resize textarea depending on the parent element

javascript,jquery,html,css,textarea
So I need to resize the textarea in this form to take the whole available space in the box depending on the parent element (#wrapper). How do I do that? I will exactly put the negative number calculation more precise when I am sure how much text will go there....

Whitespace in textarea

php,textarea,whitespace,simple-html-dom
I build an array of URLs from the content of a textarea, than process it with simple php dom. I get this error: Warning: file_get_contents(http://www.example.com ) Obviously, there is a whitespace at the end of the URL (which is the last in the array and the last in the textarea)...

Setting Background of TextArea

css,textarea,javafx-8
I would like to provide for user possiblity to select color of TextArea: private void updateTextArea(){ textArea.setStyle("-fx-text-fill: #" + textColor + "; -fx-background-color: #" + backgroundColor); } however this doesnt change color of whole background. Ive found on the Internet that to change backgroud of text Area I need to...

How to delete a selection of textarea

javascript,textarea
I'm making a a simple texteditor and for that I'm using a function which gets the selected text of a textarea. My problem is not getting the selected text but when i add some tags to the selected text, for example bold or italic, it appends. So what I want...

Is it possible to set different colors for different lines in a javafx textField/Area?

java,colors,javafx,textarea,textfield
I know that you can set a color of a whole textArea/Field by setting the style of the node to be -fx-text-fill: red; but is there a way to set the color of one single line instead of all of the lines while still keeping the textArea/Field editable?

Avoid line returns on textarea text

html,css,textarea
I am having an issue with the text in my <textarea> tag. Here is the matter : My web app is a html page which write text on textarea on button click. When you click on this button, here is what the <textarea> shows : As you can see, I...

htmlentities() does it remove return character and carriage return?

php,mysql,pdo,textarea
I am creating a forum with PHP and MySQL with the help of PDO class. I have just started coding the forum and come up with a problem. What I am doing is that $post_body = htmlentities($_POST['post_body']); get the user input like this and then send this to my function...

Detection of textarea value chage

javascript,jquery,textarea,onchange
How can I detect, that value in my textareaId has changed when the change was caused by javascript? eg. $("#buttonID").on("click, function(){ $("#textareaID").val("lorem ipsum"); }); $("#textareaID").change(function(){ //not working }); $("#textareaID").bind('input propertychange', function(){ //not working }); ...

check whether any html tags entered in textarea using javascript

javascript,jquery,html,textarea,htmlspecialchars
I'm having a simple commenting system, where i want the user should not type any html special chars, if they done like that they should give an alert of "html tags not allowed". How to do it? while submitting, a ajax call is passed to another page to store it...

Adding psuedo elements to tag not not showing up

html,textarea
I'm trying to make myself a file manager, and I managed to make an "edit file" function in PHP. In the main page I do have a textarea, but when I want to edit the main page "source", the text stops exactly where the textarea tag closes (</textarea>) Here's a...

How do I allow bootbox to accept multiple lines of code?

javascript,modal-dialog,textarea,bootbox
This code works: <script type="text/javascript"> bootbox.alert("Hello world!"); </script> This code doesn't work: <script type="text/javascript"> bootbox.alert("Hello world!"); </script> If you're gonna ask why I need it like the second one, it's because that value will be based off of a textarea which has multiple lines of code, I somehow need to...

Understanding of css textarea offsets

html,css,textarea,typography
I made a simple example of textarea on jsfiddle with font-size and line-height. JSFiddle textarea textarea { font-size: 20px; line-height: 4; height: 260px; } <textarea> A A A </textarea> 1) How does browser calculate the AREA_1 height and the AREA_2 height? Why are they different? 2) How does browser calculate...

Convert HTML text area value to jqmath formula

javascript,html,textarea,jqmath
I am new to jqmath; I have contained a textarea field in my HTML: <textarea cols="30" rows="2" id="mathSrc1"></textarea> I will set mathematical formula in the text area so that it will be displayed in <div> tag: <div id="mathTgt1"></div> This code is available in http://mathscribe.com/author/jqmath.html. But I don't know how to...

ReactJS component not rendering textarea with state variable

javascript,textarea,reactjs
I am facing an intriguing bug in React. I have this component: 'use strict'; import SummaryStore from '../stores/SummaryStore'; import React from 'react'; export default class ChangeSummaryForm extends React.Component { constructor() { // store initialisation SummaryStore.register(); var vRating = SummaryStore.getBookForSummaryPrint().summaryRating; var vStarClassName = this.getRatingClasses(vRating); this.state = { sStarClassName: vStarClassName, sCurrentBookToShow: SummaryStore.getBookForSummaryPrint()...

Java FX Textarea performance issue in .jar

performance,jar,javafx,textarea
I have a TextArea that I would like to be able to append characters or words to over a period of time. I use Timer from java.util and when I run application in Eclipse everthing works ok, but when I export application into .jar I have performance issue. Here is...

Render multiple values, separated by line break, within a textarea

javascript,html,angularjs,textarea,ng-repeat
I am rendering a dynamic form in angular. When attribute has multiple values I wish to render them within a textarea. Each value on its own line. But cant't get it to work! This is what I have so far: <script type="text/ng-template" id="form_field_text"> <label for="{{field.displayName}}">{{field.displayName}}</label> <br /> <div ng-if="field.multivalue ==...

How define textarea content on form edit (Symfony2/TWIG)

forms,symfony2,textarea,twig,value
I want to display a specific content in my editForm textarea so I try like text field but it doesn't work : {{ form_widget(edit_form.description, { 'attr': {'value': 'content'} }) }} {{ form_errors(edit_form.description) }} How can I do it in TWIG ?...

making the backround of a javafx textArea clear

java,javafx,textarea
I was looking into this whole text area class in java, I was going to use it in my cool GUI i'm making but, when I was looking to make the background clear the only thing I could find is a method that allows you to set the opaqueness. but...

How many characters can “javascript var keyword” store?

javascript,textarea
I want to create a variable to store the value of textarea by using var keyword. But I don't know exactly about the maximum characters which "var" can store. Can you help me?...

how to set css and html in textarea [closed]

html,css,textarea
Is it possible to set a mark (html) in textarea? Because (I think thats for everyone clear) if you set: <textarea><mark>this text has a mark</mark></textarea> that this not works Is it just possible to give an element in a textarea an exact color?...

Gap around textarea within a table

css,textarea
I've done some research on removing the gap I've got around a textarea located in a table. Depending on the browser, it appears at the top (IE, Chrome) or bottom (Firefox). <table border="0"> <tr> <form method="POST" action="updatereview.php"> <td class="shrink"> text </td> <td class="shrink"> <select name='update_score'> <option value="1">1</option> <option value="2">2</option> <option...

Escaping apostrophies and other characters in text area

php,html,forms,escaping,textarea
So I have found that this form I have just falls apart and doesn't even submit the content up until the first apostrophe when someone types in an apostrophe to this text area. How do I go about escaping the contents so they make it into my MySQL table? Thanks!...

HTML/CSS Textarea and Div are different height

html,css,css3,textarea
I've styled a textarea with min/max width and min height (to allow scaling vertically, but in no other direction), and put a div next to it with the same height. For some reason, although the CSS doesn't lie they're different heights. Anyone know why and if there's a way to...

Create textarea with same style as angular validation

javascript,angularjs,textarea
I'm working on an angularjs project, and currently I'm in the form validation phase. I know that textareas don't work the same as <input>s do, but is it possible to get the same rounded corner? And if possible the same red border when it's invalid? Specifically rounded corners, and the...

How do I set these buttons 'id' values to append in the textarea?

javascript,jquery,html,textarea
I've been given a code which contains wingding characters that relate to a letter different from its normal attached key, and I'm trying to create a program that deciphers them. Unfortunately I can't work out how to add to the textarea, only overwrite the character already there which isn't very...

jQuery focus() on textarea that belongs to a form dynamicaly added into the page

javascript,jquery,html,focus,textarea
I am dynamically adding a new form into page using clone(), but when I add it I want to make form's textarea focused. I've got the code below but it doesn't work: .on('click', '.edit', function(e) { e.preventDefault(); var $comment_holder = $($(this).closest('li')); var $edit_form = $('.comments form').clone(); $edit_form.find('textarea').focus(); $comment_holder.append($edit_form); }); I...