I have a kendo drop down list it binds on page load.
I have a filter section and I filter one drop down list and I click the submit button and its submitting the page.
When I am clicking the submit button I validates the drop down list whether the user selects the valid input or user types invalid data.
When I clicking the submit button, I save the valid data in hidden field and assigns the value to model property.
After submits the page the selected value(before submits) is selected in dropdownlist.
If now I submit the page once again the drop down list selected index comes as -1.
How to validate this drop down list in the above scenario?
You need to set it's value from model when rendering the page again.
You can easily set by following way using jquery:
$(document).ready(function(){
var dropdownlist = $("#movies").data("kendoDropDownList")
dropdownlist.value($("#value").val());
});
Related
have to create multi step signup form from api response( JSON )
form can contain upto 3 pages and should support text field, select box and checkbox group.
The form should support the following validations.
a. Required
b. Regex(Input should match the regex configured in json.)
c. min and max value(text field only)
Each page should have a front and back button at the bottom and final page should contain submit page.
When the next button is clicked, all the fields in the page should be validated. If there are any errors, they should be highlighted.
If not, user should be taken to the next page. When submit is clicked, the value of all the form fields should be collected as a key value pair and sent to the service for processing.
I am using angular5 in that I am using form array to dynamically generating the fields. Initially I want to load form array as 0 files. If I am clicking plus button I want to add two fields. With validation.
If from array is empty i.e now fields are created I have to submit the button without this dynamic fields.
If fields are created I have to set validation without entering information in fields i won't enable submit button.
If I am setting validators.required in form array I can't able to submit without entering in first two fields
I need a solution for this one guys.
Assuming you are using template driven approach, the place where you are looping through your data to generate dynamic controls, create an index variable like *ngFor=" val in collection; let i=index" and then use that i to make each control unique by appending i with the name of the control like <input type="text" name="txtId-{{i}} #txtId="ngModel" [(ngModel)]="someId" />
Now if you try to use txtId.valid inside the loop it will be unique for every row.
I am trying to load multiselect dropdown value based on click button action dynamically. When one click is performed value is selected and appended in the dropdown. But when I clicked next time, the dynamic values are appended to the previous value. So I decided to clear multiselect dropdown on each click.
But when values are selected dynamically, To clear dropdown
$('.ui.fluid.dropdown').dropdown('restore defaults');
$('.ui.fluid.dropdown').dropdown('clear');
Both also not working. Because of dynamic appending of data.
So my question is how to clear semantic mutiselect dropdown dynamically.
I tried to use the following code to clear the dropdown and it works fine.
var class_name = $('.ui.fluid.dropdown');
$(class_name).dropdown('clear');
$(class_name).dropdown('destroy');
$(class_name).dropdown('restore defaults');
I have a dojo table container embedded within dojo form. I'm able to validate all dijits like textbox, combobox etc and submit the form. But what I need is, submit the form only when a value is changed i.e. if a textbox value is changed, submit the form else don't.
Add a hidden text input field which is empty while loading page. Then After you make a change in your text field check the content in the hidden text field and your respective text field if they are same then don't submit the form.
Dojo input fields maintain the original value in the private attribute of '_resetValue'. Before submitting the form, you can check whether _resetValue is different from .get('value') and submit the data..
If all the attributes are under the Table container, you can fetch the children of the table containers and verify using array.every() function..
var unmodified = array.every(container.getChildren(), function(widget){
return widget._resetValue == widget.get('value');
});
Every time i enter set of values like Group Name,Group Abbreviation,URL in the text boxes and click the save button automatically its saves in the database and for each set of values a new details view has to be generated dynamically with a web panel and the header of the web panel should have the value of Group Name.
Example:
Group1
Name Group1
Abbreviation G1
URL http://stackoverflow.com
Group2
Name Group2
Abbreviation G2
URL http://stackoverflow.com
A new details view with web panel like the above has to be generated every time the save button is clicked.
Thanks in Advance.
This solution assumes each group is a single database record.
Use a datasource which pulls all of the IDs for the groups that should be displayed on the page.
Create a repeater control and set its datasource to the datasource created in step 1
Add a hidden input field to the content template for the repeater control. Bind it's value to the group's id.
Add a details view control to the repeater control template.
Add a datasource to the repeater control template that returns a group record filtered on the hidden input control.
When you submit a new group, make sure to rebind the data on the repeater control created in step 2.
Alternatively, it would be much easier to just use a listview if possible.