html text field - html

which property is used for write all text for capitalize in textfield.
And how?
please reply

you can use css property "text-transform":
.myClassName {text-transform:capitalize;}
link for details

There's no attribute that says "this field can only contain capital letters". What you might be able to do is add text-transform: uppercase to the CSS for the text box, but the actual value of the box will still contain mixed case.
If that's not good enough, you could add an onchange event handler that says something like this.value = this.value.toUpperCase();. That'd alter the value passed back to the server, or the value your scripts see (as opposed to the CSS, which only alters the value the user sees).

Related

cypress Input with text-transform uppercase not picking correct value

I have an html input with style text-transform: uppercase, so whenever a user types a value into it, it turns to uppercase. But when I use cypress to locate this elemen't's value using
.should('have.value', FIELD),
I still get the original value entered in lowercase not the value displayed in the input field, which is in uppercase.
is there a way cypress can handle this kind of a situation?
FYI I am using "cypress": "7.4.0"
CSS text transform is applied in the browser render, but does not affect the javascript, as far as I know.
The best you can do in JS is query the CSS property of the element
cy.get('span')
.should($el => {
expect(window.getComputedStyle($el[0])['text-transform']).to.eq('uppercase')
})

HTML - Lock default value in text area and user insert more info

Im not sure on how to explain this but, what I want to know is there if there is any way to "lock" just one part of an text area in a html form. Example:
<input name="example" type="text" id="example" valeu="__this part cant be modified__, and here user insert aditional info" />
And then I get this field value as like: "this part cant be modified + what user typed"
Thank you
I don't think you can, your best bet would probably to just append your default value to their input upon submission.
No, there isn’t, not for input elements, not for textarea elements.
You can however create an impression of such behavior, e.g. having some text and an input element on the same line and setting their style as similar as possible (setting all text, background, and border properties). Of course, the form data would still consist of the input value. And prepending the fixed text to it in client-side JavaScript would be possible but normally pointless, since it would be inherently unreliable and since you can simply make the form handler behave as if it got that string (i.e., make it have it as built-in data).

Static placeholder for input

I don't know what will be the correct title for this question. I have inputbox with 'static placeholder', example for url jsfiddle.net/manyahin/MxRqX
<div class="controls">
<input type="text" />
<span>http://</span>
</div>
User can't delete http:// and type text after this. Span have margin-left: minus for position above input, and input have text-ident for get free space for span.
When I click at input, cursor set in start of input, before http. And when I start typing, cursor go to normal position. How to fix this bug or please give me an alternative method to make this happen. Sorry for my bad english.
If the input text always needs to start with http:// the easier way would be to put it as a label before the field rather than in it and then prepend the http:// on the backend. or you could catch it on the back end and read the text from the input field and prepend http:// to the input text if the user didn't enter this.
another way would be through jquery where you can set the value of the text box to be http:// with whatever text the user inputs.
A third less elegant way is to use two input fields and use css to position and style them to appear as one. set the first field value to http:// (assuming it is always going to be http://) and set it to readonly.
How about using :before in css?
Give this a go....
http://jsfiddle.net/MxRqX/3/

How to modify how TinyMCE format text

TinyMCE color formating is putting in to span tag,
now I need when ever user change color for a text add
one extra character
(for those who may wonder way I need this, read this: Inserting HTML tag in the middle of Arabic word breaks word connection (cursive))
so this is how TinyMCE normaly format text:
<p><span style="color: #ff6600;">forma</span>tings</p>
this is how I need to be:
<p>X<span style="color: #ff6600;">forma</span>tings</p>
so before any span I need to add one extra character.
I was searching throug TinyMCE source but I couldn't find where it assembly this.
I totaly understand your need for a word-joiner.
Depending on the browser you might be able to insert this character using a css-pseudo element - in this case before: http://www.w3schools.com/cssref/sel_before.asp
Your tinymce content css (use the tinymce init setting content_css) should contain the following:
body span:before {
content:'\2060'; // use '\00b6' to get something visible for testing
}
UPDATE: Approch2:
You can do this check to enter your word joiners:
var ed = tinymce.get('content') || tinymce.editors[0];
var span = $(ed.getBody()).find('span:not(.has_word_joiner)').each(function(index) {
ed.selection.select(this);
ed.execCommand('mceInsertContent', false, '\u2060<span class="has_word_joiner">'+this.innerHTML+'</span>'); // you might want to add the formerspan attributes too, but that is a minor issue
});
You might need to call this using an own plugin on special events.

Storing text in database with tags

Can anyone please help me with this? I want to know how to store text in database with the tags. For example, if the text is bold, italics, underlined, justification, paragraphs, space etc., then even that must be retrieved and displayed in the textarea of the jsp page. Please help me out!
use function getTag("id_of_tag") to get tag.
attached its value and save it to database.Later retrieve it and show in view.
Create a field in database with datatype Text
Use some javascript text-area such as tinymce so that user can enter the text bold, italic etc.
Save the field with proper sql injectioning after form submission.