Sitecore WFFM make 1 of 2 fields required - validation

I'm trying to create a WFFM form and I need to set one of two fields to be required. Do I need to create custom fields? Or is this something that I can achieve with the module itself?

You could possibly use the Morph module, which you can download from the Sitecore Marketplace.
From it's description:
Selection-dependent inputs require users to enter additional
information related to an initial selection before they can complete a
form. In almost all cases, it allows making web forms simpler and more
responsive to user actions and personalizing forms depending on
visitors’ features.
If memory serves it uses the Sitecore Rules Engine to decide which fields to show/ hide based on inputs. However, I'm not 100% sure whether you can use the Required checkbox there, but worth a try.

No custom field types are needed. The WFFM Form Designer has a Required checkbox for each field row and most standard fields support this along with a custom validation message.

Related

ServiceNow Add a Form Section to multiple Configuration Items

I am currently working on a project in ServiceNow that requires me to configure around 500 descendants of the Configuration Item table by adding multiple form sections to the CI's with around 10-20 fields in each of these form sections. I currently am doing this by going into the Form Design for each CI, and manually adding these form section and fields for every CI individually, which takes far to long to do for 500 CI's.
Is there a way to add a form section to multiple CI's without having to go into the form design on every CI you want to change and adding it manually?
Technical answer: yes, because all of that form layout data is stored in tables (sys_ui_form_section, sys_ui_section, sys_ui_element, etc) that you could script to insert relevant records. However, due to the complexity (form sections, form elements, ordering) and the potential to run into conflicts (forms differ between tables), I would recommend this only as a last resort.
I think the real question is why is it required to have all of those fields displayed on the forms? If you're populating data from Discovery or a large import, can those fields just be visible by a list page, or just be available to use in filters? Will users actually be clicking to view a CI record and need to see that data on the form? The other part to consider is which view you are adding all of these form sections and fields to. As an example, a user won't see the data on a reference field hover if you're only making changes to the Default view, and won't see any of the fields on a mobile device if you don't add to the Mobile view.

How to make model field conditionally required in MVC3?

I have a view with a dropdown and a Rich Textbox. This view is associated with a model. I would like to make Rich Textbox field is required based on the value selected in dropdownlist.
is there any out of the box feature available in MVC3 to do this?
I have had similar requirements in the past, I solved them using FoolProof. It provides extra validation objects such as requiredIf etc.
Only issue I have had is with the JS file, it can be a bit buggy around dates and date handling, other than that, it is ace.
Foolproof site

Adding custom fields to the article component

I've recently added custom fields to the article component using the documentation in the following url:
http://docs.joomla.org/Adding_custom_fields_to_the_article_component
Now this adds the custom fields defined to every new and existing article. Is there a way to define custom fields for specific article layout overrides.
Example:
If I have custom layouts for the category blog, (news, portfolio, events) can I define different custom fields for each category when creating a new article?
Kind of the way custom post types work in wordpress, or the way k2 component works, can this be done in joomla alone?
This is considerably easier to manage in K2 since the functionality is built in to do specifically what you want. It is trivial to assign extra fields to each category without having to go through the much more complex process described in your link.
However, if you want to stick with com_content, then you will need to create alternative layouts for displaying each category. You will still have all of the custom fields show up in the admin, but you can control the display on the front end with the alternative layouts. Here is the documentation (it's the same for 2.5) - http://docs.joomla.org/Layout_Overrides_in_Joomla_1.6#Introduction_to_Alternative_Layout_Feature_in_Version_1.6

Joomla component parameters

How to create serialized parameter?
i.e. I have one or more depositfiles link, different for each article.
Also there are perhaps other fileshare services
You don't say which version of Joomla you're using, so answering for 1.5+
Joomla 1.6/1.7
One option is to use a text field type. See a list of all the types available to you here:
http://docs.joomla.org/Standard_form_field_types
However, it is possible to create your own custom field type with a better user interface. Say, a text box with a '+' button that gives you more text boxes for links as needed, but saves in a similar manner to the above. This works the same as custom field types in a component - see here for a tutorial:
http://docs.joomla.org/How_to_create_a_modal_form_field_in_1.6/1.7
Joomla 1.5
Use a text parameter type. See a list of all the types available to you here:
http://docs.joomla.org/Parameter

MVC3 selectively validate client side

Each form in the application has a set of radiobuttons. Once selected, only certain fields associated with that radiobutton will need to be validated.
I am using MVC 3 and need the validation to work client side.
Simply using DataAnnotations I can only validate all fields on the form.
IValidatableObject doesn't work clientside.
IClientValidatable looks like it might do the job, but it seems I would have to write a new attribute for every standard DataAnnotation attribute.
RemoteValidation works with one field at a time.
Another option would be to drop MVC3 validation and do it all using jQuery. I don't have a problem with this as such but would like to use MVC3 and reduce coding/maintenance in preparation for a much larger project.
Could I still use MVC3 validation but then use jQuery to add/remove validation fields from validation whenever a radiobutton is selected?
If anyone can help with some suggestions as to the best way to approach this, it would be much appreciated.
MVC 3 uses jQuery's validation plug-in by default and that plug-in will not validate disabled fields. Are the fields that you don't want to validate no longer needed if certain radio buttons are selected? If so, then you can just disable those elements and they won't be validated (and note that those disabled fields won't be posted to the server either).
e.g.
$('input').attr('disabled', 'disabled');
For complex validation it is best to hand code these.
Data Annotations work great for 90% of your validation needs, but fail dismally with What/If scenarios.
For the client side use an event driven custom validation presented via jQuery Validation Plugin. For the server, use the CustomValidation attribute:
http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.customvalidationattribute(v=vs.95).aspx
Using IClientValidatable is great if you have reusable custom validation, however it is wasted time for one off validations.
Alternatively use RemotValidation with a CustomValidation attribute that invalidates multiple fields.

Resources