Set a Date Value to a Date Field in AX2012 - x++

I'm new in ax2012 and i create a new table with a field of type date, then i create new form to submit rocords
In form a create a new dateEdite control and in EDT property I specified TransEdite to show icon calendare in form.
My problem is when i try submit form, i can't insert date value in date field.
how can I fix that?
Best regards

Can you check that DataField and DataSource of the forms control are pointing to your date field on the table?
If it is a transaction table you are creating, best make use of EDT "TransDate" as data type.

Related

Default value for field set to current datetime in form view in Odoo

I have a field last_update in which I want to store the current datetime as a user edits a form in form view. Basically I need to default the value of last_update to the system's date.
I tried using:
<field name="last_update" default_last_update="datetime.now()"/>
But, it is not working.
In the python file:
from datetime import datetime
last_update = fields.Datetime(string='Last Update',default=lambda self: fields.datetime.now())
In Every model, you will always have "write_date", which stores last record update time.
Still if you wants to add this field and update it every time when record update then you can set default when record create and inherit write() method to update every time when record update, set current time in that field as following :
last_update = fields.Datetime(string='Last Update',default=fields.Datetime.now)
#api.multi
def write(self, vals):
vals.update({'last_update':fields.Datetime.now})
return super(<your_class_name>, self).write(vals)
You Can Also Use This:
from datetime import datetime
last_update = fields.Date(string='Last Update',default=datetime.now())

ASP.Net MVC DateTimePicker inside Kendo Gird not getting current time on Create

I have a popup with kendo grid inside that displays records, the first column is
col.Bound(m => m.RecordDate)
.EditorTemplateName("DateTime")
.Width(180).Format("{0:dd/MM/yyyy h:mm tt}");`
This is the DateTime in EditorTemplate -
#(Html.Kendo().DateTimePickerFor(m => m)
.HtmlAttributes(new { data_bind = dataBind}))`
The problem is when I go to that view, and create a record let's say current datetime is 19/10/2017 8:30 AM when i save the record it get's the correct time, the grid is reloaded but the popup is not being closed and then let's say 3 minutes have passed, and I create a record again but the datetimepicker's default value is still 19/10/2017 8:30 AM, instead of 19/10/2017 8:33 AM
Since the window is not being closed then the binded dateTime to the datePicker will allways the be the dateTime that was binded the first time the window was loaded. The element doesn't refresh and there isn't any configuration for it to always get the current DateTime since it is not possible.
If for example you open any window and until your save a couple of minutes have passed the value of the dateTime will again be wrong. If you want the absolute moment of the save you can't give it to the user to insert it or alter it. You should set it at the save event at that exact moment that the save occurs
If however you still want to allow the user to handle that dateTime one way I can think of is to reset the dateTimePicker value to Date.now() every time the user focuses to the window. Obviously you will still have the issue of the time passing while the user inserts his data...

Umbraco Form - Remove time from Datepicker date in email

I have a form that contains a Datepicker and in the email that is sent on submission the date is formatted with a time.
How do I remove the time from the date?
Thanks
You can either change the property to just Date, without the time element, or you can use ToString() method for the DateTime within C#:
https://msdn.microsoft.com/en-us/library/zdtaw1bw(v=vs.110).aspx
The format without time would look something like this:
yourDate.ToString("DD/MM/YYYY");

Turn off Mvc Date Picker Validation

I have a date field in my grid. I can't seem to figure out how can I turn off the validation if a user doesn't enter a date. In my data model the date property is not decorated with required attribute. Also in the database that I am using the date column is allowed a null and has a default value. I also turned off the Client Validation in the web config file. But still can't figure out why the date field has client validation turned on. The telerik version I am using is 2011.2.712.340.
So I was able to find out how to turn off the client validation if the user is not required to enter a date while filling a form. When declaring the data model if you have the property to as nullable:
public DateTime? YourDateProperty {get; set;}
then you can edit or insert a new record. In my case I had the date field as one of the columns in the grid and I was having problems where I could not insert a new record without the user having to enter a date.

Add empty value to a DropDownList in ASP.net MVC

I'm building a data entry interface and have successfully bound the columns that have reference tables for their data using DropDownList so the user selects from the pre-configured values.
My problem now is that I don't want the first value to be selected by default, I need to force the user to select a value from the list to avoid errors where they didn't pick that field and by default a value was assigned.
Is there a more elegant way of doing this than to add code to include an empty value at the top of the list after I get it from the database and before i pass it to the SelectList constructor in my controller class?
The Html helper function takes a 'first empty value' parameter as the third argument.
<%=Html.DropDownList("name",dataSource,"-please select item-")%>
You can also use this way:
dropdownlist.DataTextField = ds.Tables[0].Columns[0].Caption;
dropdownlist.DataValueField = ds.Tables[0].Columns[1].Caption;
dropdownlist.DataSource = ds;
dropdownlist.DataBind();
dropdownlist.Items.Insert(0, new ListItem("Select ...", string.Empty));

Resources