Kentico Form Aria-Label - forms

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?

Related

EntryHandler with PlaceHolder Text above in .Net MAUI

How to Display Entry Control with PlaceHolder Text in MAUI.
I need to write a EntryHandler which would look like the below Image
(Last Name* is the placeholder text)
I have written a entry handler with out the border which is looking like below, the problem with this is as the user starts typing the placeholder text hides
public class BorderlessEntry : Entry
{
}
public App(AppShell page)
{
InitializeComponent();
Microsoft.Maui.Handlers.EntryHandler.Mapper.AppendToMapping(nameof(BorderlessEntry), (handler, view) =>
{
if (view is BorderlessEntry)
{
#if __ANDROID__
handler.PlatformView.SetBackgroundColor(Microsoft.Maui.Graphics.Colors.Transparent.ToAndroid());
handler.PlatformView.Hint = view.Placeholder;
#elif __IOS__
handler.PlatformView.BackgroundColor = Microsoft.Maui.Graphics.Colors.Transparent;
handler.PlatformView.Layer.BackgroundColor = Microsoft.Maui.Graphics.Colors.Transparent;
handler.PlatformView.BorderStyle = UIKit.UITextBorderStyle.None;
#endif
}
});
}
I have been able to achieve the same in Xamarin Forms using MaterialEntryRenderer but the same is not supported in .net Maui
Any help is appreciated!

Create a new link stye in Typo3?

Is there a way to add a new style to the Insert Link dialog in Typo3?
Currently they are "internal-link", "internal-link-new-window", or no style.
I have tried putting various things in the Page tsconfig with no results at all...
I found this on another site which looks like it does what I want but I can't get it to do anything:
RTE.classesAnchor {
tollerLink1 {
class = button
type = page
titleText = Button
}
}
RTE.default {
classesAnchor:=addToList(button)
}
In your TsConfig (Home Page Properties - Resources - Page TSConfig)
RTE.default.buttons {
link.properties.class.allowedClasses := addToList(internal-link-new-window)
}

Configuring Single RTE Wrapper for Multiple Classes - Typoscript/Typo3

I'm trying to write Typoscript that will configure the Typo3 Rich Text Editor to wrap a given element with more than one class.
In the project's TsConfig/Page/rte.txt file, I have:
RTE {
classes {
button {
name = Button
}
}
However, I'd like to create a wrapper that would give the element more than just a single class. The below code doesn't work, but illustrates what I'm trying to accomplish:
RTE {
classes {
button {
name = Button
}
button danger {
name = Dangerous Button
}
}
According to this article, this doesn't seem to be possible, but I thought I'd ask and see if someone out there got crafty with their Typoscript and was able to accomplish this.
I tried everything to handle styles for tables that way, but there is currently no way to handle more than one CSS-Class for a RTE style definition.
The only way to handle this, is creating new CSS classes and extend the available button styles via LESS or SCSS.
In TYPO3 7 you can use this following RTE configuration to use multiple classes. The magic happens in the class-definition with the attribute "required"
RTE {
default {
proc.allowedClasses := addToList(btn-dark)
buttons.link.properties.class.allowedClasses := addToList(btn-dark)
}
classes.btn-dark {
name = Dark-Button
requires = btn btn-small
}
classesAnchor.buttonDark {
class = btn-dark
type = page
}
}

setting a default text to a GWT ListBox

I am trying to create a ListBox using GWT. I am using UiBinder to create the field.
I would like to set a default text on the list box and when a user clicks on the box, it should show me the list items. Once again, if user has not selected any option, it should show me the default text again.
Any way to do this either using Uibinder or some ListBox methods?
If I understand correctly you want a value to show but when the user clicks on the list it disappears and shows you the list items?
As far as I know there is no option to that natively.
What you can do is add the first item to hold your default value.
You can do this grammatically by using addItem in code or using:
<g:Listbox>
<g:item value="-1">Default text</g:item>
</g:Listbox>
works with gwt 2.1+
The value can still be selected.
You can choose to ignore it or add an attribute "disabled" with value "disabled" to the option element:
listbox.getElement().getFirstChildElement().setAttribute("disabled" ,"disabled" )
hope it helps a bit :)
You can also use a renderer to control what is shown if 'Null' is selected.
(Inspired by: How do I add items to GWT ListBox in Uibinder .ui.xml template ?)
private class SimpleRenderer implements Renderer<T>{
private String emptyValue = "Select a value";
#Override
public String render(T val) {
if(val == null) {
return emptyValue;
}
return val.toString();
}
#Override
public void render(T val, Appendable appendable) throws IOException {
appendable.append(render(val));
}
public void setEmptyValue(String emptyValue) {
this.emptyValue = emptyValue;
}
}

how to disable a jqgrid select list (dropdown) on the edit form

This is strange and any alternative method to what I want to accomplish is welcome. My app uses the jqgrid 3.5.3 and I need to disable a select list on my edit form. When I do so using the code displayed below it breaks the edit form - meaning I can not cancel or submit it. Thanks. This code is in the edit options array of the navGrid method. The the dropdown is the 'serv_descr' field. The others are text boxes and don't pose a problem. The form does come up and the field is disabled - its just broken.
beforeShowForm: function(eparams) {
document.getElementById('equip_id').disabled = true;
document.getElementById('service_dt').disabled = true;
document.getElementById('serv_descr').disabled = true;
document.getElementById('calc_next_svc').checked = 'true';
}
afterShowForm: function(eparams) {
$('#equip_id').attr('disabled', 'disabled');
$('#service_dt').attr('disabled', 'disabled');
$('#serv_descr').attr('disabled', 'disabled');
$('#calc_next_svc').attr('checked', true);
}
Note:
replace event trigger afterShowForm
id name must be form controll