Following the example as documented in the following http://symfony.com/doc/current/cookbook/form/dynamic_form_generation.html
This adds the fields in the event subscriber first, then adds the fields that have been added in the form type.
Does anybody know how to change the ordering around so that the form type fields appear first in the form view, then the fields added in the event subscriber appear after?
Thanks in advance
I had the same problem. I solved it by moving form building ($builder->add(...)) from MyFormType::buildForm() to listener leaving there only $builder->addEventSubscriber(...) statement.
There's two different manner to order your fields,
When building your form, you've to add fields according to the order
you went to display them, it allows you to get the right behavior
using form_widget(form).
Customize your form rendering. You can then put every part of
your form in the right position so that it looks the way you want.
Related
I have a CompositeField consisting of a LinkField and TextField in my dialog.
On select of data for LinkField, I want to populate the TextField also with a value related to the LinkField value.
Any idea how to do this?
This is for Magnolia CMS. I'm using the latest Magnolia version.
Thanks! :)
There is no ootb binding between different fields.
To create it, you would either need to write your own field that will internally encapsulate the link field and text field and register listener for link field value change and upon change set value for the text field.
Or you would need to rewrite dialog presenter to be able to register such listener on the link field when it's being created.
Sorry, don't have any code samples at the moment to demonstrate it. Hope the explanation is clear enough.
HTH,
Jan
Do you need to update the text field in view of the editor?
If not, this can be easily achieved by modifying the save action. Your form should have a commit button defined with class=info.magnolia.ui.admincentral.dialog.action.SaveDialogActionDefinition
Open SaveDialogActionDefinition and you'll see it points to info.magnolia.ui.admincentral.dialog.action.SaveDialogAction which, when executed, can manipulate the node before saving the session.
If you extended SaveDialogAction, added another method similar to setNodeName(Node node, JcrNodeAdapter item) and called it between setNodeName(...) and node.getSession().save(), you could set any additional property you wanted based on those entered by the user.
You would also need another definition class that referenced your new action so your dialog definition knew to use the new action on commit.
Is it possible to automatically # a field on a Google Form? I would need the numbering to appear on the actual form and not just on the spreadsheet it ties to. The idea is so that someone could place an order, fill out the form, and give the automatically generated # to the vendor.
Please point me in the right direction if this is possible.
Thanks!
Have an item for this number and define it as required and select-from-a-list. Generate the number (somehow?) in the OnLoad trigger and populate this item. The number being the only one to select user has to select and send with the form. Bit crude solution, but workable I think.
Better option would be to make that item a section header and populate in onload trigger as above.
Available types of triggers indicates that there is no onLoad trigger within Google Forms API. However, I believe it is possible to use jQuery to search for '#' within the form and increment the value.
I have form in getcmsfields_forpopup for backend(admin panel) in silverstrip. In that form, I have added nested dataobjectmanager field to enter multiple dates(has_many relation). When main form open in popup window and I click on add date link, then second popup form open in the same window not in separate one. That means after entering date data and saving it, when I click on close button, whole form is closed rather going back to main form. Please help in this regard.
This can't be done using SilverStripe's default popup form unless, maybe, you extended the DataObject Manager field and had it render itself in an iFrame.
The best option would be to manage your parent DataObjects with DataObjectManger as well. DataObjectManager supports nested DataObjectManager fields. See this tutorial "Nested DataObjectManager" (on YouTube).
If you're able, can I suggest that you try out SilverStripe 3.0? The support for this kind of thing is much better in SilverStripe 3.0 than it is in 2.4.
I'm creating 2 content types: 'Event' and 'Speaker'. An event has multiple speakers.
For the relation I'm using the entity reference module.
I want to make a view where I can see an event with the speakers' information, picture, ..
Someone told me to use display suite too, but I don't really know why I would need this.
What would be the best approach?
Thanks in advance for your help! :)
Simon
You can definitely do this with views: display the fields of a referenced node in a view.
Create a view that displays all the fields you want from your event, but then, to be able to pull the appropriate speaker fields for that event, you'll have to add that speaker relationship.
Go to the 'Advanced' section of your view and click on 'Add' next to 'Relationships'
Select 'Content: Speaker' or whatever the exact name of your referenced field is
Now you should be able to see and select any of the 'speaker' field from the field list, but make sure when you choose one of the speaker fields, that you select for the 'Speaker' relationship to be used when displaying it. It's an option on the field settings page.
Does that work for you?
Yes, you can do this with Views.
But since you're using the Entity relationships, you need to add two relationships in your view. One for the relationship from 'Event' to the 'Entity' and another from the 'Entity' to the 'Speaker'. It's like adding a Many-to-Many join table.
Make a view of Events
Make an Entity relationship between Events and Speakers
Add a relationship between Event and the Entity Relationship
Add another relationship to Speakers that uses the relationship from step 3
Add whatever fields you need from the Speakers nodes.
Hope that helps. I got stuck on that for a long time myself.
The main issue is going to be managing 'duplicates' if you have more than a 1:1 relationship. You might be able to manage that with the "Use Aggregation" feature.
An alternative I came up with for an outdoor activities site I was working on ( http://dev.naturefitter.com/packages ) that avoided the duplication issue was to use Views Field View ( http://drupal.org/project/views_field_view/ ). I created a main view (in my case 'Packages') and a subsequent sub view ('Activities') that takes a contextual filter from the main view. The sub view is a block that has the fields from the Activity content type and a contextual filter that expects the nid from the package content it's attached to.
Best,
Pat
I'm using Views dropdown filter (with tags) and it works great. However I would like to customize it in this way:
1 - remove button "Apply" and automatically update Views (at the moment I'm updating it with Ajax)
2- allow my customer to change the order of the dropdown items (specifying top items)
3- select multiple items without having to press the SHIFT button on keyboard (do not unselect other items if new items are selected)
http://dl.dropbox.com/u/72686/viewsFilter1.png
Let's suppose the items in the image are tags... something like this:
http://dl.dropbox.com/u/72686/viewsFilter2.png
thanks
Use jQuery to .hide() the Apply button, and then set a handler on the filter fields so that whenever one of them is changed (i.e., by the user), the Apply button registers a click.
Hmm, can't help with this one. You might be stuck writing a custom module that hooks into the Views API.
Sounds like the Sexy Exposed module would solve this problem?
I'm using the following code to keep the items selected and it works.
$('#edit-tid option').click(function() {
$(this).toggleClass("selected");
$("option:not(.selected)").removeAttr("selected");
$("option.selected").attr("selected", "selected");
//submit request
$('#edit-submit-Portfolio').click();
});
When a request is submitted the page is refreshed. The selected items are still selected (class="selected") but the javascript code do not keep them selected.. I don't understand why, since they have the correct class attribute.
So.. it doesn't work after refresh, even if the html code is the same (the same class="selected" attribute is assigned to the same items).
thanks
I've solved point 1 and 2, installing better exposed filter module from drupal website.