Using text conversion on input element actually converts text?

Given that text conversion is a CSS property, I don’t understand how the text in the input field, which has the text conversion to uppercase, actually sends the text of the page to uppercase when the form is submitted. Shouldn't CSS change the look of the page, not the content itself? If I type something in lower case on a form, shouldn't it obey in lower case and just appear in upper case in the form field?

I use PHP to process column variables, and any text that I type, with the text converted to uppercase, is actually in uppercase. I am changing the value that was lowercase, the string "This is a test." for example ... If I delete the test and retype it in the input field and send it, then print the value presented, it will print "This is a TEST". with reprinted uppercase text and any original text in the same case as before. Is this just bad behavior or something else?

+3
source share
2 answers

Test code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><title></title>
<style type="text/css"><!--
textarea, input{
    text-transform: uppercase;
}
--></style>
</head>
<body>

<?

if( !empty($_POST) ){
    echo '<pre>' . htmlspecialchars(print_r($_POST, TRUE)) . '</pre>';
}

?>


<form action="" method="post">
    <textarea name="textarea" rows="3" cols="40">Default</textarea>
    <input name="text" value="Default">
    <input type="submit">
</form>

</body>
</html>

Interesting findings:

  • Opera 10 ignores text-transform: uppercasetextareas
  • Chrome 4 sends a GET request for a POST form
  • , (Windows XP), , : Firefox 3.6, IE 6, IE7, IE8, Opera 10...

, JavaScript...

+3

, , . , ( , , <h1>), , , , .

edit ...

  • Chrome 4 Windows ,
  • Firefox 3.6 Windows ,
  • IE8 , .

, , CSS.

+1

Source: https://habr.com/ru/post/1735017/


All Articles