I'm sending value with hidden form field but value not set with [value] property of input tag.
Here is my code :
<input type="hidden" [(ngModel)]="model.tokenval" formControlName="hiddentoken" [value]="{{tokenval}}">
You can not set value like this.
You have to use setValue() and patchValue() methods of reactive form groups.
In setValue() you have to set all formGroup values and in patchValue() you can specify values which you want.
Reference Link: https://www.concretepage.com/angular-2/angular-2-formgroup-example#set-get
Related
I have a page with multiple textboxes and dropdowns with values that I am trying to validate. The values in them will be dynamic in each run.
The HTML looks something like:
<input readonly="readonly" class="form-control valid" data-val="true" data="ABC" aria-invalid="false" xpath="1">
What I want to do is grab the value of "data" for each textbox. I have used scriptAll before in such a case when I was grabbing text by using innerText. However, that won't work with a regular value such as in the HTML above.
I did try one solution that worked:
driver.value(//input[#data])
However, that just grabs the first textbox value, is there a way I can combine scriptAll with driver.value? OR would I be better off doing some JS here?
Thank you in advance!
Yes, refer the docs for scriptAll(): https://github.com/karatelabs/karate/tree/master/karate-core#scriptall
Use whatever JS works to get an attribute value. Haven't tried, but this should work, you get the idea:
* def list = scriptAll('input', "_.getAttribute('data')")
I am trying to set an input value in vue-formulate which is a computed value. The value gets computed (check console) but it is not set as input value.
Reproduction code - https://codesandbox.io/s/vue-formulate-reproduction-template-forked-j9jtc?file=/src/App.vue
You need to v-model the computed property with the FormulateInput instead of one way binding the value. Here codesandbox
<FormulateInput
name="lmp_mcp_difference"
type="number"
v-model="days_difference"
label="Difference of days between LMP and Registration Date"
/>
For updating the values property you need to assign the values as it has lost reactivity from the vue instance.Updated codesandbox
I am using a value converter on an input with type text in aureliajs. While it is updating in normal way, it converts the value both in input and its bound value. But when adding & updateTrigger:'blur', the input text does update on user blurs but the bound value not getting data. For example:
<input type="text" value.bind="name | converter & updateTrigger:'blur'"/>
versus.
<input type="text" value.bind="name | converter"/>
in the second case, both text of input and variable name do update but in the first case, only text does.
Is this a bug in aurelia binding or my mistake?
the markup looks ok.
Are you implementing both toView and fromView functions in your converter? I tried your markup in a test setup and it works fine. You can check it out at
https://codesandbox.io/embed/value-converter-uhjp9
Best regards.
i got empty value when i use :value and v-model together in the same element, I was trying to update some list in v-for,
here is the code
<input type="text" :value="product.productName" v-model="product">
how can i get my value it and get some update from that value when client change it because I need to use that value for the update list?
i have some list to show the value on input so i should keep showing the value because i dont want it to be empty , u guys know how to update so we need the value keep on the input
Consider sample below:
//edit.html
<input type="number" step="1" value.bind="number" />
<div repeat.for="num of number">${num}</div>
//edit.ts
export class Edit {
number: number = 2;
}
I expect to see 2 divs on first page load and number of divs should change when I change number in input. Instead I get error
Value for 'number' is non-repeatable
I figured it out. If you bind input field to variable, even when variable is number, it will be changed to string when changed by user. In my case, number became string once changed in input field. I used this gist to help me solve this problem:
https://gist.github.com/jdanyow/d9d8dd9df7be2dd2f59077bad3bfb399
It offers custom element and attribute for binding numbers to input fields.