Symfony2 Form Custom compound type - forms

I'm trying to make a nullable integer, that is an integer which can also have a value set as null.
To do this, I was hoping to have an integer input with a check box to signify it is null (which could then have JavaScript hook up to disable/enable the integer input).
I see three ways of doing this:
Have a custom Type which has two fields.
Have a custom form widget which handles the two.
Some combination of one and two.
I'm not having any trouble with that, it's pretty straight forward.
What I can't seem to find any documentation about is how to get those two fields to funnel in to a single variable.
Any ideas?

The best way I can see is applying a form transformer to your form.
If the checkbox is checked you set null to your property, if it isn't you assign the value of your integer widget.
You can have a look here and apply this to your particular case.
Side note: I wouldn't do this in the controller, it's not his job.

Related

Defining variable to be used in few places

Is there a functionality in Tabluau to create a variable that can be used in few places by referring to its name? I'm asking because I need to prepare a dashboard and the data loaded and displayed on the dashboard can contain two different variables in column called value. So I would need to define such a 'variable' that would be filled with the type of value column (ex. type 1 or type 2) and use it as a axis name, in a tooltip etc. Of course, I'm trying to avoid a necessity to change all the axis names and tooltips manually.
In Tableau, they are called parameters. Please refer to following articles to learn more about this.
Parameter basics
Swapping Measures using parameter
I believe what you are asking is covered in link 2.

Type enforcing input field

I am building a form with variable input fields. How the form is actually set-up (which fields and which types) is read from a database. To do this I would be using Panels, since there are also several labels per input field. The panels are then being displayed in a ListView.
When doing this, I do not like the idea to create a different panel which different markup files for each type of input (text, radio, checkbox,...), since TextField etc. check for the type set in the markup.
Is there an input field that does not read the type from markup, but supports all/some input types? Any alternative suggestions?

Select All parameter doesn't work in SSRS

I have a report which creates a list of Events for a specified date range and event type.
The date range and event type are parameters defined in the report. The date parameters (#DateFrom and #DateTo) work as they should.
The #EventType parameter however, which is defined as a list of values provided by a DataSet (with 'Allow Multiple values' checked), does not provide the expected behaviour when using the {Select All} check box. If I select one or more Event Types by checking several boxes on the list, the report will show the Events which match the specified Event Types correctly.
However, if I click the {Select All} box (which then highlights all of the other possible values), the report does not show the Events for all of these Event Type values. It seems to miss out several of the values which are selected by the {Select All} box. If I run the report specifically for those missing values, the report returns events matching those types. This indicates to me that there is not a lack of data for these types.
And for that reason, it looks to me like the {Select All} is bugged...or perhaps cached somewhere? I've tried deleting the report/parameter dataset and redeploying to no avail. It's worth noting that this behaviour happens locally before deploying it, too.
Has anyone seen this before, or does anyone have any suggestions?
EDIT - I should also mention that the parameter in question (#EventType) has no default value assigned.
How are you declaring your predicate for the variable? It should be be like:
where thing in (#Variable)
Where #Variable is a multi value parameter.
You could attempt to see if the values of the multi valued parameters are junked up somewhere as well by defining them. Generally the collection method of multi valued parameters can cause issues if there data types are different.
Also you may try to design your data set at runtime to build instead of being a static query. EG: Set up an expression for your dataset like:
="Select * from table where thing in (" & Parameters!Variable.Value & ")"
This would cause the parameter to build as part of a string and then evaluate at run time instead of from a traditional query.
Can't quite believe that this was the case, but the parameter which was passed to the SQL Server procedure was too small. It was defined as a VARCHAR(500) and needed to be bigger to deal with a large list of comma separated values. I changed it to VARCHAR(4000) and it's now functioning as expected.
Thanks to Djangojazz for pointing me to the direction of the parameter.

Multiple values for one field

In GXT I want to create a form where a single field can have multiple values. so once one value is provided user should have option enter another value for the same field, similar to how we attach files in an e-mail.. what is the best way to do this?
One way to provide a button with plus symbol in the form. Clicking that button should add a field to the form dynamically. User can use that field to provide another value.
If you are talking about a single control, which can capture multiple values, can you try Multi-Select field like the one explained in this thread?

How do I make large text boxes use null instead of blank string when empty

Here is my issue. I am currently forced to use Access and I am writing some generic validation that I can add to forms.
It was all going well and catching empty fields in form_error based on the error "You tried to assign the Null value to a variable that is not a Varient data type"
All of my required varchar fields are NOT NULL.
Unfortunately if a textbox has a control source to a large varchar DB field it behaves differently. I can't remember the size threshold but assume this behaviour difference would be equivalent to text vs. memo in an access table).
Basically, if you delete the contents of a small text box control it attempts to write null and the error is caught. All good.
If you do the same on a text box linked to a larger varchar, or memo database field then it writes a blank string which is considered valid.
I have confirmed this by changing the db Schema between varchar(50) and varchar(256), updating the linked table in Access and restarting Access for good measure.
I am hoping someone can point me to a property to set or some tiny piece of generic code that can be added to make all text boxes behave the same regarding writing NULL/Empty string when they are empty regardless of the size of the DB field they are connected to.
Just to note that also the box behaves differently on insert or edit. If not filled on insert it does leave the DB entry as null.
That's pretty much the way you have to do it. You could set up a "Validation Rule" on each text field, but again that would require hunting down all the text controls.
You can make that job easier. If you check the Object Dependencies of the tables, you can get a list of all the forms (and queries, etc.) involved. Then you can be sure you have hit each one.