data-placeholder and jQueryUI autocomplete - jquery-ui

Is there a simple way to have a default text in the textbox using jQueryUI's autocomplete ?
I have tried using data-placeholder but it doesn't seem to work.
I have searched online, and people suggest using the textbox value to display the text, and clear it on focus. But then I would need to change the font style just for the default text, and check onKeyUp when the text is manually erased etc...
Is there no easier way to do this ? or am I missing something ?

A lot of people will use a span that is positioned to be over the text box. When the text box gets focus then you hide the span. When the text box blurs and has a value, you don't show it. If it doesn't have a value then you can show it again.
You can style the span however you want independently of the text box so you would not have to change the font style on the text box itself. You would have to subscribe to the focus and blur events, but it would be much easier if you created a jQuery plugin to do this. In fact, I'm sure there are ones that already exist that do this.

Related

Weird behavior for textarea in diagrams.net (draw.io) format panel

I'm facing a very weird (& blocking) issue using diagrams.net webapp.
I'm trying to add some nodes in the Format Panel. I created a new tab in this panel & added in it some new inputs.
There are text inputs, checkbox inputs & textarea.
But the behavior is absolutely not the expected one.
For text & cb inputs, everything works fine, but textareas behavior is... at least very weird:
The field can't get focus by mouse clicking (remember that click works on other inputs). The only way to set the focus on it is by using JS focus() method.
Text inside the tag can't be selected by mouse. If element has the focus, text can be updated. Moreover, even if text can be changed, text cursor cannot move from the end of the text.
Textarea box is not resizable. There is the bottom-right arrow to resize it & I added the "resize" value to be sure but the feature doesn't disable but I juste can't. BUT ! If I set the attribute "disabled" then I can resize the box. Unfortunately, I can't disable the textarea since I want to put it because I need to write in it.
I can't show you code for now (it's just a new node creation using document.createElement) but you can easily test this: go to drawio webapp & when the webapp is loaded, use the Inspector in the developer tools to add a new textarea node in the format panel (div with ".geFormatContainer" class) : element is not focusable with the mouse, text inside it is unselectable & box is not resizable as long as "disabled" attribute is not set.
I added a click listener in the component to check if click did something & it does, but it doesn't give the focus to the element (document.activeElement says that body is focused -_-) so I think there is something in mxgraph which avoids the element's classic behavior. But what ?

Removing Formatting from Text Box Controls - InfoPath

I'm working in InfoPath and somehow created about 16 Text Box Controls with formatting that I cannot override in terms of text size as well as strikethroughs. Any suggestions to be able to remove the formatting and be able to maintain these controls?
It sounds like you got into the code and accessed the toolbar. If you right click on the textbox and go to properties it should take you to the properties window. Make sure under the space next to "Text" in the properties window is blank.

Button on jQuery UI

I am writing a script using jQueryUI's button http://jqueryui.com/dialog/#modal-form.
The button is pretty fancy looking.
Now, when I tried to use jQuery to change the display name of the button:
$('#signin').text("new name");
The Button revert to the original style of the browser, with no padding and etc. I don't know why change of style happens when I just change the display name of the button. Please suggest me a way to fix it.
To change button text use this :
$('#btnId').val('new-text');
I figured out how. I used a span tag around the display name and just change text of that span tag.

Dynamically change certain text in textarea with drop-down selection

I have a text area that has names within the default value. For example the textarea reads..
(dynamic registrant name) just registered to become
a donor in (dynamic from pull-down above)
honor. This text is editable
So in the same form I have an input that asks the user for their name and a select box where they can choose among a selections of names. I am trying to change the names within the text area based on the values they enter in the input and drop-down fields above the text area. Can someone help with this? I am completely stuck. I have read through some of the forums here and it looks like a lot of the solutions are to use ajax. I have zero experience in ajax and would like to find a solution that does not use that...is it possible? Or could someone help with a solution?
I don't think textarea is what you want exactly. What if the user takes off the (dynamic from pull-down above) part? How would you know where to put the text at? Even if you somehow could, I suggest you make regular text input elements for contents that the user can change and put the other dynamically changing text as uneditable html text elements (or however you want to format them).

How to change the color of some text in textbox - Silverlight 3?

I have a usual TextBox. I know in order to change the color of some text I can use Run tag. But when I try to use it imperatively instead declaratively (because I need to do that dynamically) I have the text in TextBox like
AAA<Run...>Text to be changed in color</Run>
and sure nothing in color changes.
How can I change the color of some text in some program way?
Thanks
I'm fairly sure you have to use a RichTextBox for that, TextBox only works with plaintext.

Resources