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?
Related
I'm working on a project based on Laravel 5.3 and Backpack CRUD. My project has about 8 different content types (news, page, portfolio, events, team, video, gallery, jobs).
I need to be able to add tags to every content type (n-n), and every content type has its own specific tags, so tags are NOT shared between the content types.
If I want to use the select_multiple or select2_multiple field type, I would need 8 tables for the content itself, 8 pivot tables, and 8 tables for the tags(!).
Obviously I would like to have just one table for the tags, but if I use the select_multiple or select2_multiple field type, I get all tags in the edit-form of every content type.
So, my question is: Is there an elegant way to filter the results of the select_multiple or select2_multiple field type?
I have created a simple schema with two content types:
http://dbdesigner.net/designer/schema/60412
In this example I want to be able to filter the tag list on content_type_id, when I'm editing the content of news or page. So I just want to see the news tags in the news-edit form, and just the page tags, in the page-edit form.
Or maybe I should just use the select_multiple field type as intended, and accept the 8 tag tables(?)
Any help or advice would be greatly appreciated.
I think a clean way would be to:
create different models for each tag use, so NewsTag, PageTag, PortfolioTag etc. that would only extend the Tag model and use a global scope to filter the results after content_type_id;
use backpack select2_multiple fields with NewsTag, PageTag, PortfolioTag etc; anything you set on the Tag model will be used (including the table attribute, mutators, accessors, etc);
Cheers!
I want to add a form text component multiple times in a page and give different id's to them in CQ5.
The default form text component doesn't provide option to specify an id, rather it generates one itself.
The id that is generated is the formId_elementName, where formId is the id of the form which is present in the form start component(defaults to "new_form") and the elementName is the value that is provided in the Element Name field of the form text component.
But, in case you would like to provide the authors, the ability to add their own id's to the form start component, then one possible way would be to override the default form text component.
Add an additional field to the dialog box of the form text component called id and use that value in the jsp as id for the input field. But be cautious when providing this functionality, as the authors may forget to update the id fields appropriately, there by resulting in many text fields having the same id.
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.
I need to build the following form field. Let's take the case where in a form I have multiple fields. Two of them are "last name" and "first name". Instead of the classic way when these field will show seperatley I want a single fields thatt shows when completed like a text field with value a concatenqtion of e two values ( ie "michael jackson"). When I click on the field an window (like a picker date) will popup haing a form with the two fields.
Unfortunately i do not know where to start from:
what class should I derive
how should I store the value in the form ( two hidden values or just a serialized value of the fields).
I might have complex structure with 5-6 fields in this picker popup.
I would extend Ext.form.field.Picker. In the createPicker() method you can crate whatever combination of fields an components that you want.
Re: storage of data, I'd serialze the values in the one field. Then you can treat reads and commits in the same way (and you can always manipulate the data later.
Here's an example that I did a while back: jsfiddle.net/existdissolve/wMcQk/
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?