Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Making a Required CheckBox in Alternative Form View modes: 
User avatar
Member
Member
Armysniper89 - 11/14/2010 2:12:42 PM
   
Making a Required CheckBox in Alternative Form
I created an Alternative Form for the Custom Registration control to use. Everything is working great but I need to be able to have a checkbox field that is required to be checked before the form is submitted so the user can agree to the terms and conditions of the site. If I were doing this in my own ASPX page, I would simply have a Validator do the work.

In the Alternative Form, I added a boolean field for the terms and conditions to the User System table. Then I added the checkbox for the field and put a validator in. Problem is that the validator does not force the user to click it.

How can I make it so the user must click the check box and have it checked before the form can be submitted?

User avatar
Kentico Support
Kentico Support
kentico_radekm - 11/17/2010 5:40:39 AM
   
RE:Making a Required CheckBox in Alternative Form
Hello.

We have validators for empty values, which means that if some field have "Allow empty value" property disable and is not filled (is null), validator will appear.

But checkbox control is never null. It is true, or false, but never null. So you can´t validate it by this simple way. You have basically 2 options:

1. Use Attribute type: Text + Multiple choice with a single option only. Check value of it using regular expression.

2. Use custom form control with checkbox and validator control. Please see this chapter for more details and example of custom form control. Thank you.

Best Regards,
Radek Macalik


User avatar
Member
Member
Jeffrey H. - 11/17/2010 9:18:46 AM
   
RE:Making a Required CheckBox in Alternative Form
Well, there is a third option. Just use a little custom jQuery on the client side to ensure the checkbox is clicked before the submit button. There are lots of examples on the web for this type of thing.

Jeff

User avatar
Member
Member
Armysniper89 - 11/18/2010 9:56:49 PM
   
RE:Making a Required CheckBox in Alternative Form
Do you happen to know of any good examples? I have a deadline of this coming Monday! :)

User avatar
Member
Member
Armysniper89 - 11/18/2010 9:57:48 PM
   
RE:Making a Required CheckBox in Alternative Form
kentico_radekm wrote: Hello.
1. Use Attribute type: Text + Multiple choice with a single option only. Check value of it using regular expression.


What would that regular expression look like?

User avatar
Kentico Support
Kentico Support
kentico_radekm - 12/6/2010 4:08:50 AM
   
RE:Making a Required CheckBox in Alternative Form
Hello.

For Multiple choice you will have value of it in format: value;text. Value can be anything and regular expression depends on what you have there. Goal is that if checkbox is checked, it will pass validation, if checkbox is empty, it will not pass validation.

Basically you only need to validate an empty string (+). Please note Kentico CMS don´t use some special regular expressions, so you can use standard regular expression for empty string validation (e.g. “+” character).

Best Regards,
Radek Macalik

User avatar
Member
Member
DesignByOnyx - 12/6/2010 1:19:22 PM
   
RE:Making a Required CheckBox in Alternative Form
I use ^$ to validate an empty string.

@Kentico - with regards to the checkbox control... you have the choice of "Allow empty value".... but this does nothing... making it useless. Instead of "Allow empty value", you need to make it say "Allow false (un-checked) value" - which should be self-explanatory.

User avatar
Kentico Support
Kentico Support
kentico_radekm - 12/7/2010 1:27:09 AM
   
RE:Making a Required CheckBox in Alternative Form
Hello.

Thank you for your suggestion. We will consider it.

Best Regards,
Radek Macalik

User avatar
Member
Member
sanjeev.kumar-pyramidconsultinginc - 2/6/2013 3:28:51 AM
   
RE:Making a Required CheckBox in Alternative Form
post

User avatar
Member
Member
Armysniper89 - 12/6/2010 1:29:51 PM
   
RE:Making a Required CheckBox in Alternative Form
I ended up using a custom form control and that works great. I am glad you responded though with how to do it using the native form controls as I am sure this will crop up again for me or someone else.

User avatar
Member
Member
vin4.net-gmail - 7/4/2012 10:27:45 AM
   
Captcha ( Form Control: SecurityCode) in bizforms alternative form.
Hi,

I am using security code form control for captcha in a bizform.
When the end user submit this form, captcha also get saved along with form data.
Now, when I go to edit the particular form record, the captcha value mismatch happens between the new captcha value and old value when it got saved on form submission.

My requirement : I dont want to see that captcha field to be seen on edit of form record in administrative interface.


Thanks in advance.

User avatar
Certified Developer 9
Certified Developer 9
charbf - 7/4/2012 2:33:07 PM
   
RE:Captcha ( Form Control: SecurityCode) in bizforms alternative form.
you need to use an alternative form for the site (with de captcha visible and required)

in the fields tab you should desactivate the captcha field. (I mean not displayed)

User avatar
Member
Member
vin4.net-gmail - 7/5/2012 1:24:48 AM
   
RE:Captcha ( Form Control: SecurityCode) in bizforms alternative form.
Thanks a lot charbf... Got it fixed....

I am facing one more issue while showing tags in the the blog list.

To show, tags of a particular blog in the blog list page, I am writing this line of code in the repeater's transformation which is on blog list page.

Its getting me the respective tags under each blog but when I click on particular tag its not redirecting to respective blog.

<%# IfEmpty(Eval("DocumentTags"),"","Filed under: " + BlogFunctions.GetDocumentTags(Eval("DocumentTagGroupID"), Eval("DocumentTags"), "~/Company/Blogs.aspx")) %></div>

As of I know, this line of code is passing tagname and groupid. But I guess, we need to pass the tagid...

Please help me out to achieve this functionality.

Thanks you.


User avatar
Certified Developer 9
Certified Developer 9
charbf - 7/5/2012 9:39:14 AM
   
RE:Captcha ( Form Control: SecurityCode) in bizforms alternative form.
I have not used that functionality. but, you dont seam to have any link tag <a>

User avatar
Member
Member
vin4.net-gmail - 7/6/2012 8:03:47 AM
   
RE:Captcha ( Form Control: SecurityCode) in bizforms alternative form.
oh ok...

Anyway just for info. I achieved it by specifying Eval("NodeAliasPath") in the transformation.

So the complete transformation is : <%# IfEmpty(Eval("DocumentTags"),"", BlogFunctions.GetDocumentTags(Eval("DocumentTagGroupID"), Eval("DocumentTags"),Eval("NodeAliasPath"),"~/Blogs.aspx")) %>