Jquery-ui autocompolete default text - jquery-ui-autocomplete

I have a jquery-ui autocomplete text box and i want to set a default text for the text box and when the text box get focus i want to remove it.
How do i set the initial text for the text box?
Ho do i remove the text on focus?

try this
$( ".selector" ).autocomplete({
focus: function(event, ui) { $(".selector").val('');}
})

I managed to solve it:
set the default text of the autocomplete using the value attribute
the only way that i damaged to use the focus event is like this:
$("SELECTOR").autocomplete({
....
}).focus( function(event, ui) {
......
});

Related

Masking tooltip of a Text field

I need to hide tooltip for a password Text field. Please suggest.
I have something like below and getToolTipText() needs to return blank or hidden text, because original password getting rendered in UI.
org.eclipse.swt.widgets.Text text = new org.eclipse.swt.widgets.Text(parent, SWT.SINGLE | SWT.BORDER | SWT.PASSWORD);
It should not show you tooltip when you use "SWT.PASSWORD". It doesn't show tooltip for me.
Can you post more of your code with the text control.
Anyway if you want you can always set empty toolbox with
textControl.setToolTipText("");
but this is not necessary and it should be done without this.

ListGrid / ListGridField - Hover message while editing

Is there a way to show a hover message on an editable cell/ListGridField while in Edit mode?
Was able to have a hover message over a cell in non-edit mode by :
cusipField.setShowHover(true);
cusipField.setHoverCustomizer(getCusipHoverCustomizer());
Thank you
You should be able to manipulate the properties of the editor that is created when you enter edit mode for a field through an appropriate FormItem and the ListGridField.setEditorProperties(FormItem editorProperties) method. For example, if your field is storing texts, you shall create a TextItem and define the hover text using its setPrompt(java.lang.String prompt) method. Then use that TextItem to set the editor properties for the field.

Configure Alfresco.util.PopupManagers YUI Dialog

I'm trying to configure the width for Alfresco.util.PopupManager.displayPrompt() but I don't see how to do it.
YUI Dialog has a width property, but the only config that I've managed to see, defaultDisplayPromptConfig object, doesn't seem to pay much attention to my messing with it.
Specifically, I tried setting Alfresco.util.PopupManager.defaultDisplayPromptConfig.width but it didn't work :)
I'm also trying to style up the panel I'm loading (create-site style injected panel), but it does not work for now.
Is there a way to configure the PopupManager Prompt object?
TIA
If you look at the source for Alfresco.util.PopupManager.displayPrompt() contained in alfresco.js then you'll see that the method creates an instance of YAHOO.widget.SimpleDialog, which does support a width property.
The problem is that displayPrompt() takes only specific configuration options which it passes through to the SimpleDialog, so adding an additional width parameter to your config will not have any effect, as you can see.
// Create the SimpleDialog that will display the text
var prompt = new YAHOO.widget.SimpleDialog("prompt",
{
close: c.close,
constraintoviewport: c.constraintoviewport,
draggable: c.draggable,
effect: c.effect,
modal: c.modal,
visible: c.visible,
zIndex: this.zIndex++
});
// Show the title if it exists
if (c.title)
{
prompt.setHeader($html(c.title));
}
// Show the prompt text
prompt.setBody(c.noEscape ? c.text : $html(c.text));
// Show the icon if it exists
if (c.icon)
{
prompt.cfg.setProperty("icon", c.icon);
}
// Add the buttons to the dialog
if (c.buttons)
{
prompt.cfg.queueProperty("buttons", c.buttons);
}
// Add the dialog to the dom, center it and show it.
prompt.render(parent);
prompt.center();
prompt.show();
I like the idea of enhancing the function to support a width property and possibly others, but in the meantime you are best off using SimpleDialog directly in your own code, modifying the above to add a width parameter.

How can I create a read-only SWT text that is impossible to select? (by keybord and mouse)

How can I create a read-only SWT text that is impossible to select? (by keyboard and mouse)
for example:
Text text = new Text(shell, SWT.BORDER | SWT.READ_ONLY);
text.append("text text text text text text text text text text text text text ");
text.setSelection(10, 60); // If only I could write here something that could turn the text impossible to select, just like if it were a label.
Use a Label instead. Or use Text's setEnabled and setEditable methods.
In case Enablad property using you can`t copy text from it.
I advise to make tihs. You can create yor own widjet that contain two text box. We may name it OurTextBox. The First created as usaly, second as readonly (with SWT.READONLY flag). You may use StackLayout for layout. Then you should define some properties and methods.
Main of this:
SetText(); getText();
SetReadonly();
When SetReadonly is invoked you can show one of two internal TextBox.
Unfortunately, this is the only solution to dynamically ReadOnly

PhoneGap + iOS Prevent default scroll action begins from input text field

I've faced up with the following problem:
I have a scroll area which contains list of input text fields.
I use
ontouchmove = function(e){ e. preventDefault(); }
to prevent global scroll of the page. It works fine except cases when gesture begins from input field.
How can I prevent global scroll of the page when first touch traps to the input field?
Thanks.
I believe you want to capture the touchmove event using the addEventListener function so that the even doesn't "bubble". Try this:
/* This code prevents users from dragging the page */
var preventDefaultScroll = function(event) {
event.preventDefault();
window.scroll(0,0);
return false;
};
document.addEventListener('touchmove', preventDefaultScroll, false);
this might help
the section "MORE SPECIALIZED SOLUTION" might be what you are looking for.