var dayspace=14;
$('.timelastd').datepicker(
{setDate : new Date(),
dafaultDate: new Date(),
dateFormat:"yy-mm-dd",
minDate: new Date(),
maxDate: dayspace,
appendText: "click here",
changeYear: false,
}).keypress(function(e) {return false;});
I don't know how to put the variable to the maxDate?
Why can't this work?
if I change to this ~still not work~
var dayspace=14;
$('.timelastd').datepicker(
{setDate : new Date(),
dafaultDate: new Date(),
dateFormat:"yy-mm-dd",
minDate: new Date(),
appendText: "click here",
changeYear: false,
}).keypress(function(e) {return false;});
$('.timelastd').datepicker("option", "maxDate", dayspace);
Related
form: FormGroup;
createMyForm() {
this.form = new FormGroup<any>({
firstName: new FormControl<any>('', [Validators.required]),
lastName: new FormControl<any>('', { nonNullable: true }),
});
}
How to add { nonNullable: true } to firstName
I am trying to add {nonNullable: true } to the form control.
lastName: new FormControl('', { nonNullable: true }),
I am able to add {nonNullable: true } to the control which doesnt have validations, but for the form control which has validations I am not able to add {nonNullable: true }.
firstName: new FormControl('', [Validators.required]),
createMyForm() {
this.form = new FormGroup<any>({
firstName: new FormControl<any>('', {
nonNullable: true,
validators: [Validators.required]
}),
lastName: new FormControl<any>('', { nonNullable: true })
});
}
if all fields has nonNullable:true and you are comfortable injecting form-builder, you can use NonNullableFormBuilder
Working in VueJS with a form. I do not POST the form as I would like to keep the information client side for privacy/data sensitivity reasons. So no PHP validation.
I strip the input from possible code as follows but it should be possible to do it shorter. I am a beginner so please ELI5. For example if you use a function, where in the VUE section does it go?
Is it also possible to change a variable to contain the string "* invalid character entered" triggering when the replace function triggers?
Come to think of it, is form input still a vulnerability if it stays client side?
new Vue({
el: '#app',
data: {
clienTyp: 'B.V.',
companyName: '',
noSigCompany: 1,
n: 0,
companyAddress: '',
companyNumber: '',
companyShortName: '',
personAddress: '',
personName: '',
personShortName: '',
personPOB: '',
personDOB: '',
},
watch: {
companyName(val) {
this.companyName = val.replace(/[<>"'`$]/g, "");
},
companyAddress(val) {
this.companyAddress = val.replace(/[<>"'`$]/g, "");
},
companyNumber(val) {
this.companyNumber = val.replace(/[<>"'`$]/g, "");
},
companyShortName(val) {
this.companyShortName = val.replace(/[<>"'`$]/g, "");
},
personAddress(val) {
this.personAddress = val.replace(/[<>"'`$]/g, "");
},
personName(val) {
this.personName = val.replace(/[<>"'`$]/g, "");
},
personShortName(val) {
this.personShortName = val.replace(/[<>"'`$]/g, "");
},
personPOB(val) {
this.personPOB = val.replace(/[<>"'`$]/g, "");
},
personDOB(val) {
this.personDOB = val.replace(/[<>"'`$]/g, "");
},
I have created Dialog in AddButtonEntryPoint.js file and I want to access that variable in Form.js file to hide the dialog after click on Submit button So, How can i call.
Here is the code which i have written
AddButtonEntryPoint.js
var w = new Form({});
var d = new Dialog({
id: 'FormDialog',
title: "Bridge Form",
style: "width: 270px; height: 270px;",
content: w,
onHide: function() {
// To prevent destroying the dialog before the animation ends
setTimeout(lang.hitch(this, 'destroyRecursive'), 0);
}
});
d.show();
};
Form.js
return declare( "mypackage.MyForm", Form, {
repotextbox: new TextBox({
name: "text",
placeHolder: "Enter text here."
} , dojo.doc.createElement('input')),
DFMtextbox: new TextBox({
name: "text",
placeHolder: "Enter text here."
} , dojo.doc.createElement('input')),
submitButton: new Button({
type: "submit",
label: "Submit"
}),
constructor: function(args) {
declare.safeMixin(this, args);
},
onSubmit: function() {
var repositoryID = this.repotextbox.get('value');
xhr("https://samples.openweathermap.org/data/2.5/weather?q={repositoryID}",{
// The URL of the request
method: "GET",
handleAs: "json",
}).then(
function(data){
alert(data.success + " " + JSON.stringify(data));
},
function(err){
alert( "Your message could not be sent, please try again.");
});
},
});
}
);
In form.js file, Under onSubmit function I have to hide the dialog created in AddButtonEntryPoint.js when the user click on Submit button.
In Form.js you have to add a property that will reference the Dialog instance
return declare( "mypackage.MyForm", Form, {
myDialog: null,
// etc
}
Then in AddButtonEntryPoint you can either set this property when you initialize w if you put it after:
var d = new Dialog({
id: 'FormDialog',
title: "Bridge Form",
style: "width: 270px; height: 270px;",
content: w,
onHide: function() {
// To prevent destroying the dialog before the animation ends
setTimeout(lang.hitch(this, 'destroyRecursive'), 0);
}
});
var w = new Form({
myDialog: d
});
or you can keep it as it is and call w.set("myDialog", d); later - but in this case any code in postCreate that requires the dialog will not run.
Hope this helps!
So I have datetimepicker. And I have datatable like the following code
var table = $("#tbllogvisitor");
var target = table.attr('data-table');
var date = $("#datetimepicker3").data("date");
var oTable = table.on( 'processing.dt', function ( e, settings, processing ){
if (processing) {
$(this).find('tbody').addClass('load1 csspinner');
} else{
$(this).find('tbody').removeClass('load1 csspinner');
};
}).DataTable({
"bServerSide": true,
"paging": false,
"filter": false,
"scrollCollapse": true,
"ordering": false,
"ajax": {
"url" : "../ajax/datatable",
"type": "POST",
"data" :{
target: function() { return target },
tanggal: function() { return date }
}
}
});
Well is working, and then I wanna trigger datetimepicter if I'm changing my datetimepicter value with the following code :
$("#datetimepicker3").on("dp.change", function (e) {
oTable.ajax.reload();
});
But the paramater variable of datetimepicker still not change at all, still same at first time. How do Ii pass my value datetimepicker and reload the datatable?
Sorry for my bad english.
this is the code i use to call the form view:
get_view_form_dimension: function() {
var self = this;
var action_manager = new openerp.web.ActionManager(this);
var dialog = new openerp.web.Dialog(this, {
width: 800,
buttons : [
{text: _t("Cancel"), click: function() { $(this).dialog('destroy'); }},
{text: _t("Save"), click: function() {
var form_view = action_manager.inner_viewmanager.views.form.controller;
form_view.do_save(function() {
$.jstree._reference("#new_tree").destroy();
self.get_tree_structure();
});
$(this).dialog('destroy');
}}
]
}).open();
action_manager.appendTo(dialog.$element);
action_manager.do_action({
res_model : 'df.bi.dimension',
res_id: self.process_id,
views : [[false, 'form']],
type : 'ir.actions.act_window',
flags : {
search_view: false,
sidebar : false,
views_switcher : false,
action_buttons : false,
pager: false
}
});
},
how can i set values into the form that this method will rise ?? or in case that exist other solution please tell me ? sorry for my english!
Add a context field to your do_action call with default values, like this:
context: {'default_account_id': 5, 'default_name': 'hello'},