Issue related to Kentico on-line form (bizform) validation - kentico

I have created a form using Kentico on-line form and applied the built-in "required" validation on it. Whenever a textbox is empty then a required validation is shown. Now, I have entered a value in the textbox and press tab from the keyboard but the required message does not disappear. I want to remove or hide the message from the form when the user enters a value in the text box before the submit button is clicked.
How to resolve this issue?

I don't recall this being something that Kentico handles out-of-the-box. You'll most likely need to add some custom client-side script for this. Typically - where I work, at Ridgeway - we use custom layouts for forms, as the standard layout is fairly table-rich.

Related

How to change xpage form for new document?

Right now I am working on a Xpage which displays data from a domino document. Based on the form of the document different fields will be displayed.
Now I want to create a "New" function. My idea here is to set the view I am previously using in edit mode.
Additionally, I want to add a radio button which enables a user to choose the form of the document he wants to create.
Based on this radio button the document form should change which should result in the elements displayed on the page changing too.
Overall if I switch between the radio button options and hit save, a new document will be created with the right form.
Yet my problem is that my elements in my view won't change dynamically. So if I switch my form there will still be elements/controls displayed for the default option but not the selected form.
My idea was to create an onChange-event for my Radio Button Group.
My questions here would be: How can I change my formValue for the Xpage (new document) and then reload it with the new set value?
Thanks for your explanation.
I understand you have one XPage suitable for multiple forms, I assume using a Switch control and custom controls per form. About the New button, you could try first to have 3 New buttons, each for a separate form, and you create a URL like yoursite.com/xpage.xsp?action=newdocument&form=someform
When the user clicks the button, your page can read the parameters (param.action and param.form) and act accordingly. Or do you intend to update the current page using partial refresh, as a single page approach?

Kentico Forms - CMSCheckbox always renders an empty label

This is for: Kentico 11, kentico forms
I have been tracing an Accessibility violation caused by the CMSCheckbox. Finally found the issue. It seems kentico is forcing the label of the checkbox to be rendered even though it is empty. It is doing this by setting the Text property of the checkbox to a none breaking space if I do not set it to something.
I am using the CMSCheckbox in a form with a caption. I need the caption to be non empty as I use it for something else on submission of the form. Since the caption is a label for the same checkbox this violates yet another Accessibility rule of only having one label per control.
My question is:
- Why has kentico done this? Why is the CMSCheckbox forced to always have a label when asp does not force it?
This "hack" was added to support localization of the CMSCheckBox control. I am afraid but there are no settings available for this so you will need to create a custom form control and use the ASP check box inside it.

How to validate CheckBox in Kentico 8.2?

I am working in Kentico 8.2, and I want the user to have to accept all of the terms and conditions. For this, I am using a check box. If that check box is unchecked then user will not be able to submit the form.
This is not achievable through Kentico help which says that I can achieve it by making the check box multiple choice. I have done this and it works but I want the check box's own validation to work.
I cannot attach a picture here otherwise I would show you guys what I have done so far.
If anyone has a solution then please help.
Do you use the basic Kentico forms module?
You can use Validation on a field.
in the Forms module:
new field "conditions"
check "Required"
default value unchecked
Validation "Add validation rule"
select General condition
Enter text > press edit and in the code tab add the following macro:
{%conditions.Value == 1%}
add an error message
dont forget to press Apply and save the field
This worked in my sample.

Conditional Client Side Validation?

I have a radio button group that gets it's values using an #Dblookup. In addition to the name to appear in the radio button group, the document also has a field to determine if another field on the xPage should be displayed or not.
If the field is displayed then it should be required.
I can do the conditional validation just fine in SSJS using an #DbLookup to lookup the document selected in the radio button group.
But I would like to be able to do it CS so it is faster and so it looks like my other validations. Is there anyway to do this?
If a field is not rendered then the node will not exist in the DOM. Your CS javascript would need to examine the DOM and look for the node, normally by looking for a specific ID. As Xpages changes the ID's sent to the browser your validation function would either need to be computed so it would know what ID to look for or you would need to look for it in some other unique way ( like add a css class name to just that field and then do a DOM search for nodes with that class name )
Once you can determine if the field has been rendered then you can run your usual CS validation routine against the other field.
If you're using client-side validation throughout your app, setting the required property on the field should achieve what you need.
If not, it may be worth looking at the Extension Library Dojo Validation Text Box. All the Extension Library Dojo control run client-side validation, even if validation is set as server-side at application level. Bear in mind that for the Dojo Validation Text Box, just setting the required property is not enough. You need to add more specific validation.
After that, the key is to ensure the partial refresh event on your radio group is set to skip validation. I haven't tried, but I believe that should achieve what you need.

XPages templating dialog boxes

I am currently on a project redesigning an existing traditional domino web application to XPages. This application contains a web form with quite a lot of helper dialog boxes. Also notifications and validation and confirmation is done through dialogboxes.
I know I can create a custom control for each dialog box and add it to the Xpage and call the show. I even managed to load it dynamically using a dynamic content control with a facet for each dialog. Since the dialog cc contains a show() in the onClientLoad. It is easy to open a dialog by switching the content of the dynamic content control.
Still, adding all these custom controls to my XPages feels inefficient and really clutters the design tab. What's your take?
I would prefer setting the content of the dialog dynamically (Like in traditional domino you would define a form for each dialog). Is that possible?
If not is it possible to load a custom control dynamically (Like using a computed subform)?
Also for confirmation boxes I need the OK button to execute different code for each confirm. What would be the best way to implement that? Add custom parameter "functionOnOk" to the "dlgConfirm" custom control and evaluate that in the submit button?
PS: I am still using panels with dojoType=dijit.DialogBox, but will change those to extlib dialog boxes. For the confirm and messageboxes I am now using client side dijit.Dialogs with mark-up in code, but I would like the markup in XPages as well.
I know there are issues with panels with dijit.Dialog, because Dojo moves the dialog in the DOM, which prevents any SSJS in the dialog running. I don't know if that's also an issue with dijit.DialogBox, but I suspect it could be. Jeremy Hodge did some code to workaround that.
However, I would strongly recommend using the Extension Library control. Client-side dijit.Dialogs are likely to be much more difficult to code and will not allow any SSJS interaction. I'm not aware of any Dojo properties not available in the Extension Library control, and the Extension Library control also allows you to open or close the dialog both in CSJS or SSJS. It also allows you to specify an area to refresh on close.
In terms of the properties, preload is there purely to speed up showing. Are you using the refreshOnShow property? This ensures the URL or content is refreshed each time the dialog is shown. The Extension Library chapter on dialogs has a table covering all the properties. You can set the URL to point to another XPage or another web page. This may allow you to use the Dynamic Content control to pass parameters to switch the content that should appear.
In terms of the code behind the OK button, if you use the Extension Library dialog, you have all the functionality you would have outside the dialog.

Resources