How to display the value chosen from Sliderfield xtype on the dialog? - aem

I am using sliderfield xtype allowing authors to chose a value. Currently authors are not aware of current chosen value. Is there a way to show the value as either a bubble as shown here or a separate text value outside the slider? Below is the dialog.
<backgroundAlpha
jcr:primaryType="cq:Widget"
fieldLabel="Background Alpha (Opacity)"
increment="1"
maxValue="{Long}100"
minValue="{Long}0"
name="./backgroundAlpha"
useTips="{Boolean}true"
xtype="sliderfield"/>

I Just used the below code to get the property and able to display in page. And the default dialog already shows the selected value.
<% if(properties.get("sliderfield")!=null){%> Here is your sliderfield FIELD DATA:: <%=properties.get("sliderfield")%> <%}%>

Related

AEM Inherited Component Dialog Fields Ordering

In AEM, When I created a dialog which inherit from another dialog I have seen that sometimes the order of the nodes doesn't correspond to the order in which the fields are rendered in the dialog.
Is there a way in which we can specify exactly where a field should be rendered in component dialog?
We can add sling:orderBefore attribute to component dialog field.
Syntax: sling:orderBefore=<--Node-Name-->
Ex: sling:orderBefore="parentPage"
Here parentPage is input field node, Now when you apply sling:orderBefore attribute, then that field will show top of parent page input field.
Thanks for reading.

ObjectPageHeader: titleSelectorTooltip Not Working

I am using title selector for my object page header. However, I am not able to overwrite default tooltip for the user-defined string.:
<ObjectPageHeader id="idOpreationObjectPageHeader"
showTitleSelector="true"
titleSelectorTooltip="myOwnString"
titleSelectorPress="handleTitleSelectorPress">
</ObjectPageHeader>
Using this code, it still shows me default string in a tooltip like this:
Can anyone guide me what am I doing wrong?
titleSelectorTooltip is a property from sap.m.ObjectHeader
only.
sap.uxap.ObjectPageHeader doesn't have that kind of setting.
Update: As of 1.56, the property titleSelectorTooltip is available in ObjectPageHeader too.
titleSelectorTooltip
The custom tooltip will be visible if the showTitleSelector property is set to true.
Note: If the aggregation is destroyed or set to invalid value, the default tooltip will be set. The default tooltip text is "Related options".

Angular 2 - Dynamic Reactive form with Radio Inputs build with FormBuilder, FormGroup, FormArray

Case:
I have an array of answers which I want to show in the view as radio inputs. When one of the answers is already answered it must be [checked] and if it's [checked] a textarea shows, so far so good.
Next I want to check another radio input and I want the current selected to be deselected and its textarea hidden, then the new selected radio input should be [checked] and it's textarea should show.
I use the FormBuilder and FormArray and have following issues.
I can't use index without intrapolation, I see many examples where the index is used without.
If I select another radio input, first my data disappears and it's not checked and on the second click it get's checked but now both are checked.
- I don't have access to the checked event, I can show it in the view with {{tempVar.checked}} as you can see above, if I use a template variable #tempVar, but I don't have access to it in the textarea below *ngIf="tempVar.checked". If I do use it in the ngIf I get the following error
Expression has changed after it was checked. Previous value: 'false'. Current value: 'true'.
Questions:
Is this the right approach?
An example of a Reactive Dynamic form with FormBuilder and FormArray with Radio inputs
Here is my code
https://gist.github.com/webwizart/121c85a0f316f47977cc0c99455af7bf
I would think using the tags should be reserved for unique identifiers? I wouldn't be surprised if dom renderer will update all elements with the same id.
Not sure if this will help, but you could use an answer view model instead (containing the same data) but that also has a 'checked' property
This way you can be sure that it will behave as you would expect.
e.g.: (in your component.ts)
let answers = this.question.Question.PossibleAnswers
.map(a =>
{ return Object.assign({}, a, { checked: false });
}
);
then in html you use: 'answer.checked' instead of 'radio.checked'
ps: also you could use ng-container instead of span, so you don't have an extra DOM imprint in your html

install4j: Configurable form change visibility from drop-down list

I have a Configurable Form and i want to change the visibility of another field based on the value of a Drop-down list.
For example I have a Drop-Down list with entries A,B and the variable name for it is testDD.
I have a Text field smtpMailServer that I want to display only if testDD's value is A.
I have tried the following approaches in smtpMailServer's visibility without success:
return ((String) context.getVariable("testDD")).equals("A");
return (context.getVariable("testDD")).equals("A");
and I've also tried to add a script to testDD Change Selection Script with The following code
context.setVariable("ThisFormConfiguration", selectedItem);
And use the code above with ThisFormConfiguration instead of testDD. But it's not working.
Could you please help me?
Thanks!
I have tried the following approaches in smtpMailServer's visibility without success
The visibility script of a form component is only evaluated when the form is shown. You should keep it, but it only handles the initial condition.
and I've also tried to add a script to testDD Change Selection Script with
The following code context.setVariable("ThisFormConfiguration", selectedItem); A
Using the "Selection change script" property is the right idea, but your script has no effect. There is no live binding from the variables to the form components, the variable is read when the form is shown and updated when the user clicks "Next".
You have to use the following selection script:
formEnvironment.getFormComponentById("123").setVisible(selectedItem.equals("A"));
where "123" has to be replaced by the ID of the text field.

Setvalue of autocomplete field doesn't work

I want to set value of autocomplete field using xf:setvalue. I know that firstly I have to set value of field and then set label (#label). I try to do that in following way:
<xf:setvalue ref="xxf:instance('fr-form-instance')//*[name() = $autocomplete-name]" value="'myValue'"/>
<xf:setvalue ref="xxf:instance('fr-form-instance')//*[name() = $autocomplete-name]/#label" value="'labelValue'"/>
After that in form builder I see, that in main instance it looks properly:
<xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all">
<form>
<section-5>
<control-10 label="labelValue">myValue</control-10>
</section-5>
</form>
</xf:instance>
but unfortunately in my autocomplete field there is no change. I can notice the change only if I go to 'edit source' button in form builder, and without any change, I click 'apply'. Then autocomplete is automatically refreshed and I see my label: 'labelValue'. What should I do, to refresh autocomplete field after setvalue ??
regards
You need to do this by setting the label of the autocomplete, not its value, which is done by dispatching the fr-set-label event to the autocomplete control. Then, internally, the autocomplete will do something very similar to what it does if the user had entered that label, in particular calling the service to retrieve the corresponding value.