How to save a input date with backendless?

Hi all!!

I have a problem with to save a date selection in a input tiype like a this exemple:

<label class="item item-input" id="novaReservaPista1-input14">
<span class="input-label”>Date: </span>
<input type="date" ng-model="reserva1.date" placeholder="Escolleig una data">
</label>This is a exemple with ionic framework.and in the controler.js://there are more code in my pract. var reserva1 = new Backendless.reserva1;
reserva1.date = $scope.reserva1.date;
//for connect with backendless.Backendless.Persistence.of(bookingPista1 ).save( new Backendless.Async( bookingPista1, showConfirm ) );
And the result is that the system backendless capture the hour actually in the system but not the date selected in my form not save date selected in the drop-down.
understanding my problem?
Thanks, see you

Sorry, but the code makes very little sense. For example:

    What does the following line of code do?

    new Backendless.reserva1

    if you create a new object, what is the “Backendless” part doing there?
    In the following code you have “backendless” twice. Why?

    backendless.Backendless.Persistence.of

    The following code is supposed to save an object on the server, but you do not pass the actual object which should be saved into the “save” method:

    backendless.Backendless.Persistence.of(bookingPista1 ).save( new Backendless.Async( bookingPista1, showConfirm ) );

I’m sorry, I repeat the code, will be better.

In the controller.js with ionic framework.
//Guardar reserves
function bookingPista1 () {
$scope.check = {selected: false}; // to control checkbox

if($scope.check.selected){
console.log($scope.user);

//this is the important part.--------------
var reserva1 = new Backendless.reserva1;
reserva1.date = $scope.reserva1.date;

}else{
var alertPoup = $ionicPopup.alert({
title: ‘Error’,
template: ‘Has de acceptar les condicions previament.’
})
}
}Backendless.Persistence.of(bookingPista1 ).save( new Backendless.Async( bookingPista1, showConfirm ) ); //show confirm is not important in this case.And in the form html with ionic, the code is:<form id="novaReservaPista1-form9" class="list">
<label class="item item-input" id="novaReservaPista1-input14">
<span class="input-label">Data: </span>
<input type="date" ng-model="reserva1.date" placeholder="Escolleig una data">
</label>
</form>You said: The following code is supposed to save an object on the server, but you do not pass the actual object which should be saved into the "save” method.and my problem is that I save the content of input value type=date, exactly The data selected by the user and not the exact time of the system as is happening to me.In the image, you can see how it makes the system.which is the save method? is not bokingPista1?
Well, thanks and I’m sorry with my English.Thanks

in the image, the system backendless capture the hour of system but I can save the hour selecte from user in the input date.

Understanding?

  1. What is name of your table where you store the values. Is it ‘bookingPista1’ or ‘reserva1’ ?
  2. Show us the code of your Backendless.reserva1 function
  3. What is your application id

Thanks

  1. Table in Backendless is bookingPista1

  2. I share all code with all controller.js

.controller(‘novaReservaPista1Ctrl’, [’$scope’, ‘$stateParams’,’$ionicPopup’,
function ($scope, $stateParams, $ionicPopup) {

//Guardar reserves
function bookingPista1 () {
$scope.check = {selected: false}; //pel checkbox per consentir la reserva

if($scope.check.selected){
console.log($scope.user);

var reserva1 = new Backendless.reserva1;
reserva1.date = $scope.reserva1.date;

}else{
var alertPoup = $ionicPopup.alert({
title: ‘Error’,
template: ‘Has de acceptar les condicions previament.’
})
}

}
$scope.selectHour = function(event) {
//La variable EVENT és l’element clicat
var horaLliure = angular.element(event.target);

if(horaLliure.css(‘background-color’) == “green”) {
console.log (“1”)
//si esta en verd
horaLliure.css(‘background-color’, ‘red’);
}
else {
console.log (“entra”)
//Si no esta seleccionada, selecciona en verd
horaLliure.css(‘background-color’, ‘green’);
}
}

// A confirm dialog
function showConfirm () {
var confirmPopup = $ionicPopup.confirm({
title: ‘Reserva de pista 1’,
template: ‘Son correctes les dades de la reserva?’
});
confirmPopup.then(function(res) {
if(res) {
console.log(‘Si, estic segur’);
} else {
console.log(‘No, vui revisar-ho’);
}
});
};

//var savedReserva1 = Backendless.Persistence.of( ).save( reserva1 )
//Backendless.UserService.register( new Backendless.Async( bookingPista1, selectHour, showConfirm ) );
Backendless.Persistence.of(bookingPista1 ).save( new Backendless.Async( bookingPista1, showConfirm ) );

}])The problem is that not declare a reserva1? more or less like a $scope.reserva1 = {}
3. the applicatin id is 2BC692BA-F3D8-D573-FFCB-0D8999B3FB00 is declared in other js - apps.js
//Config Backendless
var APPLICATION_ID = ‘2BC692BA-F3D8-D573-FFCB-0D8999B3FB00’,
SECRET_KEY = ‘REMOVED BY MODERATOR’,
VERSION = ‘v1’; //default application version;
Backendless.initApp(APPLICATION_ID, SECRET_KEY, VERSION);

I’m sorry but my skylls are few

  1. ‘created’ and ‘updated’ columns are system columns which exist in any table and represent the date when the record was created or updated. You can’t modify them

  2. You have to create a new column if you need to store some specific values. Do this in Developer’s console. Before proceeding to step3. I assume you create a column with the name ‘date’

  3. Here is sample code for your case to create a new record in bookingPista1 table.


var newBookingPista1Record = {
 date: $scope.reserva1.date
}

Backendless.Persistence.of('bookingPista1').save(newBookingPista1Record, new Backendless.Async(
 function onSuccess(pista) {
 console.log('a new record has been successfully created in [bookingPista1] table')
 console.log('objectId of newly created record is: ' + pista.objectId)
 },
 function onError(err) {
 console.log('Error: ', err)
 }
))