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.
Related
I would like to create a single form that I can bind to a datasource in create mode and in "normal mode". The use case is that I can have an existing item in the datasource that I would like to edit, or I would like to create a new one.
I can't find a way to dynamically switch the datasource mode before opening the form. It seems that 2 forms are required to accomplish this.
Any suggestions on how to accomplish this?
It is possible to reuse form fields, but you'll still need at least two forms (containers). The idea is to create a page fragment with datasource derived from some model:
then you can add this page fragment to form (container) and override datasource.
Normally you would choose between normal mode:
#datasource.item
...and create mode:
#datasource.modes.create.item
You can find complete code sample in Project Tracker template and learn more about create mode in docs:
https://developers.google.com/appmaker/models/datasources#create_mode_datasource
I am new to Adobe Livecycle and have created an XML dynamic form using Livecycle Designer ES4. I am looking for a way to promote a text field from the form to a custom property in the Forms Properties. An example would be the user fills in the field "TextField20" and after making that entry the custom property "Project Objective" in the forms properties is updated to reflect that information. Is it possible to promote metadata like this in Livecycle or is there another solution that I may not be thinking of? I tried researching online, but couldn't find anything related, which may be due to searching the wrong Adobe terminology/taxonomy.
I assume that you're talking about Variable tab in the form properties dialog.
In which case every property added creates a node in the form hierarchy with the name of the variables.
You only have to set this variable on the exit event of TextField20.
nameOfTheProperty.value = this.rawValue;
And that's it !
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.
This is a question on edit form UI for a WP7 app:
I currently have my edit form fields set to 2-way binding which means that as the user changes them they save on edit and update the UI in the ViewModel (Method 1). So I don't need a Save button and there is no Cancel button (unless you code in logic to store the original state and rollback on cancel).
Method 2 would be to use 1 way binding and UpdateSource on the save button and then you could have a Cancel button which functions like the Back button (goes back without saving).
Method 1 is nice as it handles preservation of state if the app is tombstoned - WP7 will restore the page and your changes will have been saved. The downside is that there is no way for the user to restore it to it's starting state once they make changes. My form is trivial so I do not think this is a problem. The Back button acts as Go Back.
I also do calculations in the setter property in my VM that need to be reflected to the UI (ie you will in Field 1 and Field 2 is double the value (but they can also override it) - I use 2 way binding on Field 1 and update field 1 and 2 on edit. I can't think of a way to do this using explicit updating.
The problem is that I have a Delete button for the record, so when I use Method 1 with no Save and Cancel button the user is likely to click the Delete button as it is the only available option (they need to click on the Back button to go back).
My question is; should a simple form have a Save and Cancel button and commit the data only on Save, or is it ok to use 2 way binding and have no buttons?
Parts of this are mentioned in the UI Design and Interaction Guide page 68.
Changes to Application Settings should be immediately implemented. This
means that a “Done”, “OK”, or other confirming dialog is not needed.
...
If a task cannot be undone, always provide the user with an option to cancel. Text entry is an example.
Actions that overwrite or delete data, or are irreversable must have a “Cancel” button.
As for your situation you will need a confirmation for the delete action (see the ie settings for an example). For your other fields check the guide as other issues are mentioned and you could also see how the built-in settings work.
If it is possible that the user may ever not want to have their entered text changed it'll be easier to have a one-way binding and update the saved value only when the user specifically says to.
Yes, this can make the preservation of entered data slightly harder during tombstoning but means that it's easier fro the user to be able to change their mind.
In your situation, I'd recommend having on screen buttons for Save and Delete (and relying on the hardward back button for cancel).
I am new to MATE framework and I have been digging around some sample codes so that i can do the following:
On clicking a button (on a canvas)
Display a Panel.
The issue is that i am not trying to pass any value hence not sure of how/ what should be defined as sourcekey and targetkey. If this is the case, then how should one define the propertyinjector details.
most examples that are floating around contains details of reading data from a source and populating the same on a UI/ Display component.
Thanks
Srinivasan S
for this one you shouldn't use propertyInjection you should dispatch an event (you can make it custom), then you need to catch the event in the appropriate place and simply do whatever you want with it.