I set the date value through the Extjs value form property, but the function to clear the field does not appear in the field itself, which is present when setting the value from the calendar. What should be done?
enter image description here
enter image description here
In ext 7.5 you should add trigger to your field.
triggers: {
clearTrigger: {
cls: 'x-form-clear-trigger',
handler: function() {
//function to clean field
}
}
}
Related
I have a custom format frmt defined, but I want to be able to tell if the format is already applied to the selection before executing execCommand('mceToggleFormat', false, 'frmt') since it isn't just a matter of toggling the <frmt> tags because I use AJAX to also fetch a ID in the tag, i.e. <frmt id='nnn'>. queryCommandState('frmt') always returns false. What am I doing wrong?
Here's the code:
ed.addButton('frmt', {
text: 'FRMT',
onclick: function() {
// I've tried using ed.queryCommandState('frmt') here to test if 'frmt' is already applied.
editor_content(ed, 'frmt'); // This uses ed.insertContent to add id='nnn'
ed.execCommand('mceToggleFormat', false, 'frmt');
}
})
I have tried to use text mesh pro input field in my project but I have face one series issue with that. i.e If try to validate empty or null text in input field it fails. For example when user without typing any text in tmp input field and click done button I have set a validation like not allowed to save null empty values but when user click done button without typing any text, those validations are fails. Please suggest any idea to fix this issue. Thanks in advance.
Here is the code I have tried :
var text = TextMeshProText.text; // here "TextMeshProText" is 'TMP_Text'
if(!string.IsNullOrEmpty(text))
{
//do required functionality
}
else
{
// Show alert to the user.
}
I have set the validation like this but without giving any text click on done button it fails null or empty condition and enter in to if.
I found the problem. It fails because you use TMP_Text instead TMP_InputField.
Note that: Use the code for TMP_InputField; not for TMP_Text that is inside it as a child.
Change your code to this:
TMP_InputField TextMeshProText;
...
public void OnClick ()
{
var text = TextMeshProText.text; // here "TextMeshProText" is 'TMP_InputField'
if (!string.IsNullOrEmpty(text))
{
//do required functionality
}
else
{
// Show alert to the user.
}
}
I hope it helps you
Is it possible to add aria labels to a Kentico form. I am adding the forms to my pages using the online form widget and I would like to add aria labels to each section to help make my site more ADA compliant.
I don't see the option by default in Kentico. It's a good request though. What you would need to do is to create your own form control that has the property.
https://docs.kentico.com/k10/custom-development/developing-form-controls
What you would look to do is clone the Textbox, add a property called "AriaLabel" to the form control's properties, then add this to the new code file for the textbox
In Properties region:
public string AriaLabel
{
get
{
return ValidationHelper.GetString(GetValue("AriaLabel"), "");
}
set
{
if (txtValue.Attributes["AriaLabel"] != null)
{
txtValue.Attributes["AriaLabel"] = ValidationHelper.GetString(GetValue("AriaLabel"), "");
}
else
{
txtValue.Attributes.Add("AriaLabel", ValidationHelper.GetString(GetValue("AriaLabel"), ""));
}
}
}
In Page_Load at bottom:
if (txtValue.Attributes["AriaLabel"] != null)
{
txtValue.Attributes["AriaLabel"] = AriaLabel;
}
else
{
txtValue.Attributes.Add("AriaLabel", AriaLabel);
}
If you will utilize label attribute for a field it will generate label tag for it in the HTML layout which will be accessibility compliant. Will that solve your purpose or are you looking specifically for aria-label tag only?
I am using aloglia autocomplete.js and followed the tutorial.
I want to use autocomplete text box with others select2 selectbox.
var client = algoliasearch('YourApplicationID','YourSearchOnlyAPIKey')
var index = client.initIndex('YourIndex');
autocomplete('#search-input', { hint: false }, [
{
source: autocomplete.sources.hits(index, { hitsPerPage: 5 }),
displayKey: 'my_attribute',
templates: {
suggestion: function(suggestion) {
return suggestion._highlightResult.my_attribute.value;
}
}
}
]).on('autocomplete:selected', function(event, suggestion, dataset) {
console.log(suggestion, dataset);
$("#search-input").val(suggestion.full_name.name)
});
Problem is when I clicked anywhere beside that autocomplete box autocomplete disappear and it showed only what I typed before.
I don't want it to disappear. How can I implement it? Thanks for helping.
Please see the example below for detail problem.
Assume you have a simple form with one auto complete input field,two select2 boxes and one submit button. After you choose auto complete filed, when you click anywhere, it changed to default text. I mean, you put "piz" and it shows "pizza". Therefore you select pizza and it display "pizza".Then, you try to choose one select2 box or click anywhere. The autocomplete input field changed back to "piz".
I tried autocomplete:closed , $("#search-input").focusout to set the input field but it just changed back to my query.
To prevent it from disappearing, you can use autocomplete.js's debug option:
autocomplete('#search-input', { hint: false, debug: true }, [ /* ... */ ]);
The complete options list is available on GitHub.
Now I have it. When you need to only select and not to do any action, you can safety remove autocomplete:selected. And make sure your display key is value not object.
It saves me for trouble.
I am using the latest version of TinyMCE and I would like to integrate Google Drive Picker whenever an user clicks on Insert Image.
From the TinyMCE documentation I saw that I should use the file_browser_callback parameter but I am stuck with a couple of problems. First of all, I managed to attach the Google Picker but the Insert Image popup stays on top and there's no way for me to select a file. Even if I solve this problem, how can I set the textbox value from the Google Picker callback function? Below you can see my code, Google Picker code is pretty standard so I won't paste it.
var picker;
tinymce.init({
//other init parameters...
file_browser_callback: function(field_name, url, type, win) {
picker.setVisible(true);
win.document.getElementById(field_name).value = 'my browser value';
}
});
function createPicker() {
// Here I build the Picker...
// var picker = ...
}
function pickerCallback(data) {
//TODO: Find a way to set textbox value with the URL of the Image selected from Drive
}
I think you can hide the modal when you call createPicker():
function createPicker() {
document.getElementById('modal_id').style.display = 'none';
// your picker code here!
}
and then display it back once you get the callback i.e. pickerCallback(data):
function pickerCallback(data) {
document.getElementById('modal_id').style.display = 'block';
var url = 'nothing';
if (data[google.picker.Response.ACTION] == google.picker.Action.PICKED) {
var doc = data[google.picker.Response.DOCUMENTS][0];
url = doc[google.picker.Document.URL];
}
// set the input text value with the URL:
document.getElementById('source_input_id').value = url;
}
Change modal_id to your modal's div id and source_input_id with your source input field's id.