Angular binding to form not show all binded values with ngModel - html

I am writing an angular page which is binding a object with alot of fields to a form with many input text field. It is strange but only the first two fields are binding with values while the rest of the fields are empty. I swap the 2nd and 3rd input fields and the 3rd input field value shows up in the 2nd row spot. The 2nd input field which has been moved to the third row is blank. I looked at the HTML code but I am not sure why? I am learning angular and not sure why not all the input fields should show values. I only show 3 input fields but in my code I have more than 10 input rows but only the first 2 are showing the binded values. Any help is appreciated.
Update: I figured it out. With refreshed eyes, I noticed the error
In my HTML, I was setting dual binding and all my #name="ngModel". I had this for all my input fields. The #name needed to be unique.

Update: I figured it out. With refreshed eyes, I noticed the error
In my HTML, I was setting dual binding and all my #name="ngModel". I had this for all my input fields. The #name needed to be unique.

Related

Keep value in textboxes after adding row

i am currently working on to display the value in textboxes after adding row to the table. I am new to angular and seems i could not find the solution. At the moment, everytime i click on the Add button, the table will add new row but somehow the value that i have entered previously are gone. I need to make the value stays in the textbox every time the user adds new row.
Here is the source code that i have done:
https://stackblitz.com/edit/angular-hxduqp
Thank you.
That happens when you have multiple inputs with the same name.
One way to fix it is by giving your input names a suffix of your iterator i:
<input ... [name]="'from' + i" ...>
Here is your StackBlitz corrected:
https://stackblitz.com/edit/angular-bgdgpr?file=src/app/app.component.html
You just remove the name from the form control if not required else you need to provide the unique name to each control.
Working copy is here - https://stackblitz.com/edit/angular-gpq9nc

Paste a value in a textbox on the second tab of a navigation form access vba

I'm quite new to VBA and I've been looking around but cannot seem to find a solution to my problem.
I have made a navigation form (frmNavigation) with 3 buttons, each referring to a different form, let's call them frm1, frm2 and frm3. In the navigationform the control buttons to switch between tabs are all named differently (btn1, btn2, btn3), but the subform that shows either frm1, frm2, or frm3 has the same name: “NavigationSubform” (this shows a different form depending on which tab is clicked on, based on the 'navagation target name' referring to frm1, frm2 and frm3).
When I want to refer to a textbox (txtBox1) on form 1 (first tab) and insert a value i can do this by:
Forms!frmNavigation!NavigationSubform.Form!txtBox1.Value = "insert awesome text"
But how would I refer to txtbox10 on the second tab (frm2)? Just using the following does not work:
Forms!frmNavigation!NavigationSubform.Form!txtBox10.Value
You then get the error 2465 (can't find the field).
I’ve been trying many different things, but can’t seem to get it right. So how do I refer to a textbox on a different tab than the first one?
Help us much appreciated!
Only one subform can be loaded at once. So you've just got to break this process into two steps.
Store the value from txtBox1 somewhere outside of the NavigationSubforms (a textbox on the parent form with visible = no, a global variable or a table works).
In frm2's On Load event, set txtbox10 to be the value you stored.
Just note, that you will need to add conditions in the On Load event if you want to avoid that textbox being set to an empty string or a wrong value if you have a setup where your filter is changing.

Can't remove the value entered in the djFilteringSelect dojo control in xPages

I am using the djFilteringSelect control to show values in a dropdown as user type a value.
The lookup and typehead is working fine. The user type a letter and the dropdown allow the user to select a value which is then displayed in the dropdown field.
If the user now decide to remove the value first selected so that the combobox is empty and leave the field, then the first value in the list is now automatically filled in.
The consequence of this is that if the user have added a value there is no way to remove the value and leave the box emtpy.
I am using required=false for both the control and the dojo attribute but it does not seem to help. There are also a few other djFilteringSelect attributes I have tried like "Autocomplete" and "trim" but it does not work
Here is the code
<xe:djFilteringSelect id="test" type="select" store="jsondata" searchAttr="data" required="false" labelType="html" invalidMessage="Not valid">
<xe:this.dojoAttributes>
<xp:dojoAttribute name="required" value="false"></xp:dojoAttribute>
</xe:this.dojoAttributes>
</xe:djFilteringSelect>
Initally the field is not required, but if the user have entered a value it is required.
My question is if there a way to prevent the djFilteringSelect control to always populate the field if I have previously added a value
I found someone who solved this in another stack overflow topic, by creating an empty entry in my data store. but I could not get this to work
Dojo: Select of empty value for FilteringSelect while required=false
I do this quite a lot. Right now I don't have a working sample to show you (since I moved to bootstrap - and have to code the selects by manually adding select2 controls) but something like this should do it...
I add an "empty" value at the top of my select - and that seems to work no matter whether I am using a combobox, djCombobox or combobox with select2 from bootstrap. My markup typically looks like:
<xp:comboBox id="inputLocationSelector" value="#{User.catchListType}" disableClientSideValidation="true">
<xp:selectItem itemLabel="(none)" itemValue=""></xp:selectItem>
<xp:selectItems>
<xp:this.value><![CDATA[${Configuration.meta.listLocationTypeOptions}]]></xp:this.value>
</xp:selectItems>
</xp:comboBox>
Then you could specify "(none)", "All" or " " for the "not-selected" value depending on your needs.
Validation is a different thing so just specifying "required=false" does not give you the "empty" value.
/John

Prevent caching data of a dataTable

I have a ice:dataTable and in each row, there is a inputText. The record list is updated every time when fire a valueChangeListener on some other component.
When it resets the record list, browser shows the previous values for inputText fields in table rows.
I tried both Filter and <meta/> tags. It didn't work for me.
Can somebody tell me how to get rid of this problem?
(Backing bean keeps the actual record list)
This is a JSF problem, take a look at the following answer for details
Input fields hold previous values only if validation failed
To make it simple JSF keeps values in the partialViewContext so all what you have to do to reset all components in the partialViewContext
or if you are using primefaces you can simply add < p:resetInput target="tableId"/> to the field (nested inside) or if you are using OmiFaces then you can use ResetInputAjaxActionListener

to validate checkbox input for table using multiple rows

i using js to add multiple row in a particular table, but when submit the form all check box having the same value, so how can i validate this checkbox using js before submit so change value to if unchecked, i trying on that but got no solution, does any one this before,
thanks in advance
What are your checkboxes called? Do they all have the same name? You have two options. One is giving each checkbox an unique name, the other is giving your checkbox a name like checkboxes[]. The [] lets all the values be entered into an array so they don't overwrite eachother.
If you mean something else, you have to state more clear what you want, because it's a bit incomprehensible right now.
finally i found solution for my problem, thanks 'vindia' for the clue, i add checkbox with array, sol as below
in html
`<input id="abc[]" name="abc[]" type="checkbox" value="1">`
in js
for(var i=0;i<chkDefaultLength;i++){
if(!document.neworupdateevent["chkDefault[]"][i].checked){
document.neworupdateevent["chkDefault[]"][i].value=0;
}
}