is there a way to set dynamic field names in lightning:input like below? - salesforce-lightning

I am trying to bind the fieldname from iteration into lightning:input component. Can someone help how to bind the fieldname with the attribute.
emphasized text
layoutType="FULL"
mode="EDIT"
targetRecord="{!v.newRFA}"
targetFields="{!v.simpleNewRFA}"
targetError="{!v.newRFAError}" />

Related

Kentico - Selector to get the value of field of page type

I need to use a selector that can help me get the value of a field of the page type I have added in the content tree.
For example: If I add a page type CMS.News in content tree and set the value of the "Title" field to be "test". So which selector should I use to get the value "test" of the field "Title"?
Thanks in advance.
The easiest will be to use simple Drop-down list control and use Macro expression or SQL query (depends on if you want to retrieve custom field). I will assume that you need custom field, so you can try something like this:
Documents.WithAllData.Columns("Title").Where("ClassName='CMS.News'")#
where Item transformation and Value column fields contains field name that you need: {% Title %}

Generate dynamic key in i18n AEM

I have requirement for having a dynamic key for getting value in i18n. I am using sightly. i would be having the initial part of the key but the last part i have to attach dynamically and then allow sightly to get the value for the same. Could you please help me on it.
I guess best practice would be to have a getter at some component-bean to avoid as much programming logic within the markup as possible. If you like/need to put the logic into the html anyway try something similar to this:
<p data-sly-test.keyPostfix="${isTrue ? 'true text' : 'false text'}"
data-sly-test.i18nKey="${['some.i18n.key', keyPostfix] # join='.'}"
data-sly-text="${i18nKey # i18n}">This text will be replaced by sly-text!</p>

Is wicket:label needed with wicket:for?

In the past I have built labels for my form like this:
<label wicket:for="name"><wicket:label><wicket:message key="name"></wicket:message></wicket:label>:</label><input wicket:id="name" type="text"/>
Do I still need to use the wicket:label tag? I am not using wicket:label in wicket 7 and it seems to work fine. I may not be understanding the purpose of using wicket:label. It seems like wicket:label is just additional markup. Below is what I am doing now. Is this correct?:
<label wicket:for="name"><wicket:message key="name"></wicket:message>:</label><input wicket:id="name" type="text"/>
This example is related to Wicket XHTML tags
Have a look at the JavaDoc of AutoLabelResolver and AutoLabelTextResolver.
The <label wicket:for="name"> is handled by AutoLabelResolver. It links the HTML label tag to the HTML form component (in your case the input tag) by filling in the correct ID in the HTML for attribute of the label. It also adds css classes to the label tag for for example errors, so you can style the text in the label tag in case of an error.
The <wicket:label> has two purposes. If you give it a value either by the key attribute (as you did) or by having some text between the tags, the text is set as the label model of the Java FormComponent, which then is used in validation messages like this '${label}' is required. (see LabeledWebMarkupContainer#setLabel and LabeledWebMarkupContainer#getLabel).
If you don't assign any text to the <wicket:label> tag, then it is used as output. That means the value of the label model of your Java FormComponent is used to replace the tag.
If you have no <wicket:label> in the HTML markup and no label model set in your Java code, then your Java FormComponent will have an empty label model and Wicket falls back to using the Wicket ID as label. So depending on how your Wicket IDs look, you will get validator messages like 'user_name' is required. instead of something nice looking like 'User name' is required.

Symfony2 DOMCrawler - How to select second option of a select tag

I'm trying to select the second option in a <select> tag with the DOMCcrawler. First of all, I select the second form in the page:
$form = $DOMCrawler->filter('form')->eq(1)->filter('input[type=submit]')->form();
Then I could change each value of the form by:
$form['value'] = "new value";
but I don't have a fixed key for each value. Instead, I have a variable number. E.g. I could have something like:
$form[1234];
but also could be
$form[4321];
depending on other variables. So I need to change the form values without knowing the key values, but its position in the node <form>. E.g. something like $form->firstKey();
Also, I want to select the second option inside <select> tag, not a fixed value. Any ideas on how to achieve it?

Define default value for plain input field (Templavoila)

I tried to set the field "Sample Data" on the "Configuration" page when mapping a data element with Templavoila. But it seems it is used for something else.
Is it possible to define default values for fields like "Plain input field"?
Open the Templavoila DS/TO editor, select your field and add following to "Form"
<default>Your default value</default>
Heres an example: