jsViews and linkTo syntax - jsviews

I'm using jsViews to build a small app.
I have a input form section in which I want to provide a cancel button and a save button.
My goal is very similar to the linkTo section of the documentation.
However, my data-link is a bit more complex. I didn't find the correct syntax to bind data back to my editing object.
Here's what I have:
<input type="text"
data-link="{:Data.ListName:Editing.ListName}
id{:'txtListName_' + #getIndex()}" >
The textbox is populated with my backend data, but when I submit my form, I can't see the updated value. Neither in Data.ListName property nor in Editing.ListName.
I also tried:
<input type="text"
data-link="{:Data.ListName} linkTo{:Editing.ListName}
id{:'txtListName_' + #getIndex()}" >
<input type="text"
data-link="{:Data.ListName} linkTo=Editing.ListName
id{:'txtListName_' + #getIndex()}" >
But none of this works. The documentation is unclear regarding my issue.
What's the correct syntax ?

Ok, I managed to find the correct syntax, which is :
<input type="text"
data-link="{:Data.ListName linkTo=Editing.ListName:}
id{:'txtListName_' + #getIndex()}" >

Related

When validate Q-Select with vee-validate 4, the use-input attributes is not working and don know why the value appearing twice

Here is my code
<Field
name="options"
rules="required"
v-slot="{ errorMessage, value, field }"
>
<q-select
filled
dense
use-chips
use-input
multiple
:model-value="value"
:options="state.options"
label="Filled"
v-bind="field"
:error-message="errorMessage"
:error="!!errorMessage"
/>
</Field>
How do I use the use-input attributes and remove the double value that display in the select field? Please help thank you.
Q-Select-validation
Issue solved Thanks to logaretm.
Because v-bind="field" is doing a bunch of even listening which conflicts with that component. The field object doesn't know the kind of the component/element so it tries to cover as much cases as possible by listing to input, change, update:model-value events. In that component case it is possible it emits both input and update:model-value because of the text input inside it.
You can fix it by being selective of what events should change the value with handleChange.
https://stackblitz.com/edit/vee-validate-v4-quasar-framework-gbma2c?file=src%2FApp.vue

SAP UI5 binding by reference to another value

I have a large model with many levels and attributes and I want to have one Input in my XML view which will always edit 1 attribute from the model, but every time it will be a different attribute.
I want to edit for example attributes on following paths:
myModel>/user/0/surname
myModel>/user/1/name
myModel>/user/2/nickname
myModel>/user/3/email
Let's say that now I am interested in editing the nickname of user nr2 so I will save its path to a variable:
myModel.setProperty("currentlyEditedPath", "myModel>/user/2/nickname");
And I want to define my Input like this:
<Input value="{myModel>/currentlyEditedPath}" >
And what happens is that UI5 will allow me to edit the string "myModel>/user/2/nickname" it self. But its wrong. I only want to use the string as a reference to some other value deep in the model which should be modified and updated. I should probably write something like this, but I cannot find the correct way:
<Input value="{ ${myModel> ${myModel>/currentlyEditedPath} } } " >
Any ideas, please? .. as simple as possible. Best inline.
I think the Element binding is the good way. Feel free to comment on this:
var oInput = sap.ui.core.Fragment.byId("myFragmentID","myInputID");
oInput.bindElement("myModel>/user/2");
oInput.bindProperty("value", "myModel>nickname");
Or I can also place the value to the XML:
<Input value="{myModel>nickname}" >

unable to understand an example from developer.mozilla.org

In the following tutorial https://developer.mozilla.org/en-US/docs/Web/API/File/Using_files_from_web_applications
There is an example (at the beginning)
<input type="file" id="input" onchange="handleFiles(this.files)">
Where does this.files come from?
this.files is the objects that correspond to the files selected by the user.

Polymer 1.0: Data binding variable to <iron-meta> element (value attribute)

In Polymer 1.0, I am trying to data bind a string variable {{str}} to an <iron-meta> element (tag in parent element) as follows.
This fails:
<iron-meta id="meta" key="info" value="{{str}}"></iron-meta>
The above code breaks. But the following code works (without the binding).
This works:
<iron-meta id="meta" key="info" value="foo/bar"></iron-meta>
The difference is the variable version {{str}} fails and the constant version "foo/bar" works.
Does anyone have a clue what is what is breaking the binding and how to fix it?
Edits in response to comment questions:
How does it fail? This fails silently. The values I have printed out simply do not update when I press the Login and Register buttons.
Here is a link to the code in a Github repository. See lines
You need to use an attribute binding and not a property binding
<input type="text" value$="{{str}}" />

jQuery Validate formatting rules for range limits

I have a large table of text inputs for which a set of custom attributes are being created on the server side. These attributes included "min" and "max" which were used with the jQuery Validate plugin.
Due to a change in the requirements (of course), we now have to update the attributes to a range type, however the Validate plugin isn't interpreting the formatting of the range rule correctly (or perhaps it's more accurate to say I'm not formatting the rule correctly) and now I have problems.
The generated output for the input boxes looks like this:
<input type="text" producttype="CCC" code="ESTFEE" range="460, 500" class="currency required" id="txtEstFeeCCC" value="460.00" name="txtEstFeeCCC">
I've also tried the following:
<input type="text" producttype="CCC" code="ESTFEE" range="[460, 500]" class="currency required" id="txtEstFeeCCC" value="460.00" name="txtEstFeeCCC">
In either case, the message returned is either:
Please enter a value between 4 and 6.
or
Please enter a value between NaN and 4
respectively. Neither of which has anything to do with the 460 - 500 range in question.
The jQuery code calling the validate function is just the vanilla call:
$("#btnSave").click(function() {
validator.form();
...
});
How should an input attribute for jQuery Validate range be formatted so that the correct number range limit is displayed?
You should be able to do:
<input type="text" id="field1" name="field1" class="{required: true, range: [460, 500]}">
You could, of course, always just store the values as a range but output as min and max properties still

Resources