how can i put the value of my list with v-model and value together? - vue.js

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

Related

How to use scriptAll to grab all values when the intended value is not text type

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')")

Why does my v-select not have any default values even though I am assigning v-model a string

I am editing a vue for a project that I am working on. Below is my code
<tr v-for="(program, index) in selectedGantryLocation.pickPrograms">
<v-select :items="program"
:v-model="selectedGantryLocation.pickProgramValues[index]">
</v-select>
</tr>
The selectedGantryLocation.pickPrograms is a list of a list of strings. So each "program" that is being used in the iteration is an array of strings, it is nothing more and nothing less. The array generally looks like ["Program1","Program2","Program3" etc.]. The :items are being populated correctly and are displayed correctly in the dropdown.
Now because in this vue each dropdown will already have a previously selected value that I am grabbing from the backend, I need each dropdown to show the already selected value. selectedGantryLocation.pickProgramValues[index] is indexing a list of strings, each being the default value of each v-select that is created.
For some reason the v-model is not showing any default values. I have verified that the selectedGantryLocation.pickProgramValues is indeed populated and filled with strings. Is there an issue with assigning v-model to a string? If that is the case then I do not know how to go about fixing this issue as I have no more properties to reference because I am only working with lists of strings.
I also know that this won't work if the v-model value does not exist in the :items but I have also verified that it does exist here so that should not be an issue.
If anyone has any ideas of why my v-selects do not have any default values I would appreciate your feedback, thank you!

Setting value to a computed value

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

How to set value in Hidden form field using ngModel?

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

Visual Basic: Set attribute of web element whitout ID

HTML:
<input type="text" size="15" maxlength="79" value="" name="username">
As you can see, no ID. The HTML above is a textbox that i want to auto fill in whit my value as soon as i start the webpage whit my code.
this is what i found:
WebBrowser1.Document.Forms(0).GetElementsByTagName("username")(0).SetAttribute("value", (Text))
But whit this i get the error:
Value of '0' is not valid for 'index'. 'index' should be between 0 and -1.
Parameter name: index
What am i doing wrong?
This isn't going to find any elements:
WebBrowser1.Document.Forms(0).GetElementsByTagName("username")
"Tag name" doesn't mean the value of the name attribute, it means the name of the HTML tag itself. Like this:
WebBrowser1.Document.Forms(0).GetElementsByTagName("input")
Of course, this is likely to return multiple matched elements, so you'll need to further identify which one you want to modify. The point being that you should do some error checking to make sure that it finds anything, because trying to index an empty collection will result in an error:
WebBrowser1.Document.Forms(0).GetElementsByTagName("username")(0)
Since the collection has no elements, there is nothing at index 0.
May be u could try
Me.WebBrowser1.Document.GetElementByName("username").SetAttribute("Value", txtUsername.Text)