Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > BizForm required field asterisk View modes: 
User avatar
Member
Member
Teabag2000 - 4/28/2009 8:13:01 AM
   
BizForm required field asterisk
Hi,

I have been working with BizForms for the first time this week. They seem to work well but I have been looking for one option that seems to be missing. It is very common for fields that are required on a form to have an asterisk (*) or a different colour field label. I was hoping to find an option in Kentico to automatically display the asterisk when a field does not "allow empty value".

If this does not exist in Kentico can you please think about adding it. It would be nice not to have to use a custom form layout just for that.

Also it would be nice if you made it easier to change the default validation message for required fields. I can see in your documentation how to do it but it should be easier.

Thanks.

User avatar
Kentico Developer
Kentico Developer
kentico_ondrejv - 4/30/2009 7:01:10 AM
   
RE:BizForm required field asterisk
Hello,

Thank you for your suggestions.

Concerning the required fields asterisk:
This requirement has been already given and has been approved, so this feature should be added to one of the next version of Kentico CMS.

Regarding the validation messages:
It's really hard to do it another way, because of multilingual content. That's why you need to change them in appropriate resource strings files.

Anyway thank you again,

Best regards,
Ondrej Vasil

User avatar
Member
Member
jofes2000-hotmail - 7/22/2009 6:36:40 PM
   
RE:BizForm required field asterisk
I agree with both points here.

I assume adding the asterisk is has not been implemented yet in the current release?

Also if would definately be good to have a box on the BizForm field editor to allow changing the required field message. Could it not use the resource files by default but be overriden per field if necessary? This would then allow for seperate custom messages for requied field or regular expression validation.

Cheers
Joe

User avatar
Kentico Developer
Kentico Developer
kentico_martind - 8/3/2009 10:23:13 AM
   
RE:BizForm required field asterisk
Hi Joe,

Unfortunately, the asterisk haven't been implemented yet.

Regarding the error message for required fields, you can open BizForm -> Fields -> select field -> Advanced section and set "Min length: 1" and specify custom message into "Error message:" property. If this won't help to ensure what you need, could you please try to describe your requirement in more details?

Best Regards,

Martin Dobsicek

User avatar
Member
Member
kentico-dan - 10/23/2013 6:20:04 PM
   
RE:BizForm required field asterisk
Since this still hasn't been implemented we created some JS which might help others. (Using jQuery)

the code is for the front of the site where your bizForm will display .
<script>AAI.addAsterisk = function(containerid) {
var labels = $(containerid).find('label');
for (var i = labels.length - 1; i >= 0; i--) {

if (labels.innerHTML.indexOf('*') > 0) {
var thisLabel = labels,
labelHtml = $(thisLabel).html();
labelHtml = labelHtml.replace('*','');
$(thisLabel).html(labelHtml + ' <span class="fieldRequired">*</span>');
}
};

};

if ($('#jq_form_div').length > 0) {
AAI.addAsterisk('#jq_message_div');
}</script>

You pass it an element ID (to limit the DOM search for the label HTML) in the example above we have "#jq_form_div" as an id around our form.

The JS code searches for <label> and if an Asterisk character is present in the Label text, if it is, it removes the asterisks and adds the html string <span class="fieldRequired">*</span> to the end of the label text, so we can style it a bit better.

This might help others.