dojo form submit on change of value - dojo

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');
});

Related

Angular5 form array validation for dynamically created fields

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.

Asp net mvc 4 Kendo dropdownlist

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());
});

Domino designer display field after click

In form I have button, i want display field "Price" after button "Save" click, it's possible ?
Or can be solution to add to field HTML atribute "readonly".
In your form, enable option "Generate HTML for all fields" (check the image below):
It will generate html for all fields, even for hidden ones.
Add field price to the form and hide id by paragraph hide formulas according to your requirements.
When you have saved your form, add a flag to your document, that turns the hide formula for price field to false, and invoke the command:
#Command( [RefreshHideFormulas] );
It will make your price field visible.

Hidden model-bound values in view not getting passed to controller when populated manually

I'm using the KendoUI AutoComplete for a number of look-ups on a custom editor template that pop-ups off a grid for new rows and edits. The Kendo AutoComplete does have a DataTextField property and does not DataValueField property like a DropDownList would. So, I found I am able to get the Value of the selected item in the AutoComplete with a little Javascript and iterrogating the "dataItem" object in the select handler. And I put that value into a "SelectedID" field declared with #Html.HiddenFor(model => model.SelectedID) on the select event.
Now, when I do a save from the view and have a break point on my controller action that captures the incoming model, all those ID values where i set the value manually are empty/null/blank. I've checked the DO and have done "console.log" to read out the values of the hidden fields before the post and the values are populated. I've changed the datatypes (strings, guids, etc) and I've changed the Html Helper type as well from a HiddenFor to a EditorFor just to make sure the values are indeed there.
So i think this is a problem when the values of an element that are part of the model are populated in a "manual" fashion. The text of the AutoCompletes comes through if I bind that to a field on the model as well. Any date fields, checkboxes and free-form text fields come through as well. It seems it is just values of model bound fields where I set the values manually that don't make it over the "wire". Any thoughts? Solutions? I know the Selected Value is accessible ... it's just a matter of properly getting it into the "HiddenFor" fields.

dijit.form.Combobox show label Instead of value

I've a dijit.form.Combobox field which uses a ItemFileReadStore to pull Its data.
Teh ItemFileReadStore has two attribute per Item value which will be used for form submission , generally Unique Integers and label which is Human Understandable String.
In ComboBox HTML I've done searchAttr="value" labelAttr="label"
When the ComboBox Shows the list it uses teh label Attribute.
But When the User selects one of the Item it shows the value of that Item.
What I want is , The value Attribute will Still be used for Form Submission. But the User will always see the label in the combobox Control.
alt text http://img822.imageshack.us/img822/6660/dijitcombo.jpg
e.g. I Want to Show The Label for value 3 (Admin) instead of 3
Use FilteringSelect instead of Combobox.
Note: ComboBox only has a single value that matches what is displayed while FilteringSelect incorporates a hidden value that corresponds to the displayed value.
I have tried the following.
var cmbObject = Registry.byId('combo dojo id'); var id =
cmbObject.item.<Code Property>;
You should check if item is null.