Is it possible in silverlight to change the Required Data Annotations dynamically - silverlight

Suppose I have 3 fields on a Silverlight based xaml page
Color, Size and SurpriseMe
where none of the fields are required and SurpriseMe is a checkbox initially set to checked.
I want to create the following behavior:
When SurpriseMe is cleared,
Display the required field data annotations for Color and Size
Enforce the required Validation
When SurpriseMe is checked,
Remove the required field data annotation
remove the restriction
Is there any easy way to do this?

You need to provide custom validation (see CustomValidationAttribute). You can roll your own or use a library like Fluent Validation.

You need to use a custom validation.

Related

How To Force Table Filters To Use Input Boxes?

There seems to be a minor bug with the default dropdown filters when you enable filtering, is there a simpler way to force a table to use all input box style filters rather than to implement custom filters for each default drop down.
I think custom filters will solve the issue, but the problem is that doing so for the many tables will probably take far too long.
yes - you get dropdowns for fields where you are adding LOVs to.
But if you will create a duplication of the field (one attribute with LOV, a second attribute - without), you can show inside the table the-attribute-with-LOV, but in filter you will use the-attribute-without-LOV.
You will need to edit the jsff sources yourself.

How to make an extjs grid a form field?

I have a requirement to create a custom form field that is basically an extjs grid. The user should be able to click a result in the grid. This clicked result should then become the fields value. Also, this field needs to extend Ext.form.field. Here's what I got:
Ext.define('MyApp.field.Grid', {
alias: 'widget.GriedField',
extend: 'Ext.form.field.Base',
I'm a lot of confused on how to add a grid to form field base. Looks like form field base's template expects HTML. How do I get it accept a component?
If you just need to select a value from a list of items. Why not use a combobox?
If you need to select multiple items. There is an example of how to use the MultiSelect ux component in the documentation examples.
http://docs.sencha.com/ext-js/4-1/#!/example/multiselect/multiselect-demo.html
If you really must use a grid. Then I wouldn't bother with trying to create a field type and cause yourself grief.
Add a listener to your grids selectionchange event and update a hidden field in your form with the value you want from the grid. Job done.
I ended up putting the grid on a form indirectly through creation of dependencies on my model.
My model has master-detail, which the detail is just a store reference. I found that using associations did not work for me.
So, in adding a field to a form, I have something that manages changed events for the model (master record) and the detail stores.

ExtJS4: from which class to derive?

I'm working on custom component, which will contain combo and displayfield. It's supposed to be a combobox with validation message next to it.
I'm wondering, from which base class to derive that one in order to have such functionality like store binding ect?
Why don't you use standard ExtJs validation mechanism? It will produce exact outcome you want - a label next to the combobox.
Eventually I found that it can be a simple Ext.panel.Panel.

Cakephp Input type radio. How to use Form helper for radio options having some description and paragraph of text.

I want to use Cakephp Form helper for creating Radio buttons. But I've paragraphs of text and some design for each radio option.
How to Insert these type of radio buttons using Cakephp Form helper. I've seen before, after and separator options.
Thanks!!
If the form helper doesn't do what you need to do, you can either extend it using your own helper or simply create the markup by hand in your form.
Make sure you name your fields correctly otherwise the form post won't be in the correct format for CakePHP to handle.

Extjs checkboxes inside basic form

I have a basic form inside a window. This form has several check boxes and I need to some how be able to select all with another checkbox. How am I supposed to access these checkbox types. I am trying to get reference to "this" and then this.getForm().getFieldValues() but is there a better way to do it, as I only need to get the checkboxes and not other fields.
Thanks,
SS
By default ExtJs fields don't have a getForm() method to get access to their parent. However, you can use this override to add this method. Once you've got the form, you can get access to any field you like, which should let you do what you describe.

Resources