How to update current date every time in popup? - oracle-adf

I have a table with two columns (created by and updated by)'with EO,VO. I have inserted the current date and time by using expression 'adf.currentDateTime' in view object. Similarly I want to capture the updated date and time while making changes in data everytime.

You can capture both created and modified moment using builtin feature "history column".

You are correct to set the default value of your View Object date attribute to "adf.currentDateTime" for it to be defaulted to the current time when the View object is triggered.
To "capture the updated date and time while making changes in data everytime" In your Jsf just put the inputDate attributes immediate="true" and autoSubmit="true" so when the user change the date in the UI it will update the value in the View Object in real time.
<af:inputDate value="#{row.bindings.Date.inputValue}" autoSubmit="true" immediate="true" id="id1">
<f:validator binding="#{row.bindings.CreationDate.validator}"/>
<af:convertDateTime pattern="#{bindings.VO.hints.Date.format}"/>
</af:inputDate>

Related

OnChange "Custom lookup field" value placed inside "lightning-record-edit-form" creating records

Below is the sample code structure I am using in my Aura CMP,
<lightning-record-edit-form object-api-name="Case" record-id={recordId} recordTypeId="012">
<lightning-input-field field-name={nameField}></lightning-input-field>
<c:customLookup sObjectApiName="Account" ></c:customLookup>
<lightning-input-field field-name={descriptionField}></lightning-input-field>
</lightning-record-edit-form>
<lightning:button variant="brand" label="SAVE" onclick="{}"/>
Expecting insertion of Case on the 'Save' button,
but Ask here is:
Each time I change the value of c:customLookup, lightning-record-edit-form inserting that many duplicate records in the backend,
Solution: Because of the above issue, I moved c:customLookup outside the lightning-record-edit-form for now.
but what if I want to use c:customLookup inside the form and how to prevent that insert record automation / any reason why lightning-record-edit-form behaves like this?

Breeze/Angular: date input directive not working/strange behaviour

I'm trying to get this directive (https://github.com/eight04/angular-datetime) to work in my project. It works alright in the following plunk:
http://plnkr.co/edit/DawLbi?p=preview
But when I plug in the same code (below) into my larger scale project, it doesn't work and I have no idea why and where to search.
<input type="text" datetime="dd.MM.yyyy" ng-model="vm.firstDate" class="form-control" data-z-validate />
What happens: The input displays the formatted date correctly, but when I click on the year (or some other component) and try to change it using the number keys (enter a new year), it clears out the whole field (upon entering the first digit)! Using the up/down arrow keys works.
The problem happens only when I use the data-model on a breeze-entity. If I just put a simple js Date object on my controller and link to that one, it works.
I also tried extending my breeze entity like so:
function registerRechnungRec(metadataStore) {
metadataStore.registerEntityTypeCtor(g14EntityNames.rechnung, RechnungRec, postCtorInitializer);
function RechnungRec() {
this.datumExt = moment().toDate(); // doesn't work
}
function postCtorInitializer(rechnung) {
// this works, but not tracked by breeze then
rechnung.datumExtDate = moment(rechnung.datum).toDate();
}
// also no luck with that one:
// http://stackoverflow.com/questions/26982624/angular-and-breeze-edit-date-object
//addDateWrapperPropertyExt(RechnungRec, 'datum', 'datumExtDate');
}
A normal input with type date works just fine for entering/selecting the date. But I need to do some momentjs formatting afterwards to save the date correctly to the database then before I call entityManager.save(). Also, I don't really need the whole date picker component, a simple date input is all we need.
So how do I find out what's going wrong where?
Or is there another suggested date input directive/component, or an easier way to just have a text input field that allows me to input a date (no time) or a null date?

Angular UI datepicker - date format from API

I'm using the Angular UI datepicker component. When my data comes down from the API, I get dates in this format in the JSON:
"date": "2015-10-21T00:00:00"
The datepicker is correctly formatting the date in the input field to "21 October 2015". But, if I click the submit button on the form, without making any changes, the date field fails validation.
If I set the date model to a date object (as opposed to a string) like so, after the JSON loads:
vm.date = new Date();
Then the validation works.
So it seems the datepicker component doesn't set the date correctly, when using a string value as the model.
Any way to fix this?
Here is a link to a plunkr:
http://plnkr.co/edit/gAhme7fmIPgbojYVJlNU?p=preview
If you choose a date using the datepicker calender, it works fine. But if the date gets set using the button, as it would using JSON API data, then it fails validation.
Looking into the source code it seems that the model date can be set as timestamp (number) or as date object, but NOT as string. A string is expected as an input value and will be parsed with your custom data format dd MMMM yyyy.
See datepicker.js 780-800

how can i set todays date as default date for a date field in page properties in cq5

i have a date field(creation date) in page properties, which i want to default to todays date.
How i can accomplish this, i am using a listener on render event
even though i can read the value back, i cannot see to see the date set in page properties.
seems to me i am missing something basic
function(dateField) {
console.log("in render");
var todaysDate=new Date().format('m/d/Y');
console.log(todaysDate);
dateField.setValue(todaysDate);
CQ.Ext.getCmp("dateCreated").setValue(todaysDate);
console.log( CQ.Ext.getCmp("dateCreated").getValue());
}
You can create a widget with xtype "datetime" and apply the value as "now", in order to initialize the date field with today's date in case the author hasn't selected any.
An example widget is shown below :
"date":{"fieldLabel":"datetime","xtype":"datetime","name":"./date","value":"now","jcr:primaryType":"cq:Widget"}
This would work for Pageproperties as well.
Datetime widgets API.

Integrating a date picker with database in VB

I am trying to implement a date picker in my VB website. I am also using a database using LINQ. I have the following code to call the date picker.
<td>Start Date:</td>
<td>
<div>
<asp:Calendar ID="Calendar1" runat="server" Visible="False"></asp:Calendar>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:LinkButton ID="LinkButton1" runat="server">LinkButton</asp:LinkButton>
</div>
</td>
The table in the database has the following fields:
ProjectID (int)
ProjectName (vchar)
Description (vchar)
StartDate (datetime)
Any advice on how I can put in the datepicker and link it into the StartDate field in my database. Sorry if this is unclear. I'm just starting out. All suggestions welcome. Thanks
In my opinion you have here 3 possibilities. The simpliest is to bind it somewhere where you get data from datasource and just assigning SelectedDate property of calendar control to data from datasource:
Dim tomorrow As Date = Date.Today.AddDays(1)
Calendar1.TodaysDate = tomorrow
Calendar1.SelectedDate = Calendar1.TodaysDate
The second one is based on using DayRender event and you can find a good explanation about this method here
The last one was described in Dino Esposito's article for DevPro and can be used for the case when you need such control in many pages. So, he explain how to create a reusable user control with standard properties like DataSource, DataSourceID and DataBind method.

Resources