V-model of TimePicker can't be set to any value - nativescript

Playground example:
https://play.nativescript.org/?template=play-vue&id=dZAlXG&v=10
It's not possible to set a value to v-model, If you log it will say that is that value. But the UI don't change. It's not possible. I also tried to use :hour and :minutes but that is even worse.
Playground example: https://play.nativescript.org/?template=play-vue&id=dZAlXG&v=7
What I want is that when you press the button now that he will change the time to the current time.

Looking at your code, I think it's the issue with the initial value you are setting on selectedTime
this.selectedTime = moment().format("LT");
TimePicker works with Date object, but you are setting the initial value to a string, using a Date helps v-model to function as expected
this.selectedTime = moment().toDate();

Related

How can i force validation on the initial values in a formik form, when it mounts

I am in React 16+, using withFormik for the form.
Its a single field form which on initial use will have an empty string value. I want the initial value to be validated so the user knows they must fill a value.
So blank string "" initial value, i want the error to say "please enter a value" without the user touching or anything. onload.
formik docs claim it can do this thru the built in tools, but the library/docs dont add up.
validateOnMount:
https://formik.org/docs/api/withFormik#validateonmount-boolean
this value does nothing when set to true in my form. There are lots of logged issues of others having the same problems. It seems formik depreciated an old property that used to do this well. i cant find anything to do this without building some type of hack.
how can i have formik run the validation as ssoon as the from mounts.
in case your answer is to disable the "enableReinitialize" property, ive tried this in conjunction with validateOnMount: true and still get nothing.

Kendo UI ComboBox for Angular: how to prevent Expected value of type Object error?

I am trying to make a Kendo ComboBox for Angular not crash with error "Prevent Expected value of type Object":
<kendo-combobox
formControlName="gender"
[data]="genders"
[textField]="'text'"
[valueField]="'value'"
[valuePrimitive]="false"
[filterable]="true"
[allowCustom]="true"
required
>
</kendo-combobox>
StackBlitz
The error can be obtained if the value is deleted and Tab is pressed (combo blur). In fact, by leaving an invalid value in the box, this error will occur.
I will explain below why I am using some settings:
textField and valueField - in my application I request complex objects and the selected value will provide some information to other form fields
[valuePrimitive]="false" - the selected value is a complex object
[allowCustom]="false" - I used this to allow the control to receive an initial value that is not among the list. In my application I am using server-side filtering with an empty initial list
When using in the application (server-side filtering) I also receive this error when pushing the arrow button, but I can get rid of this by either ensuring that initial value is within the list of values (ugly) or simply by removing the button.
Any idea about how to make this work?
According to Kendo UI for Angular you have to use a valueNormalizer function to convert what the user actually types into a valid object.
public valueNormalizer = (text: Observable<string>) => text.pipe(map((text: string) => {
return {
value: this.genders[this.genders.length - 1].value + 1, //whatever value
text: text
};
}));
Please check the updated Stackblitz and let me know if it is helpful.
valueNormalizer didn't work for me at all.
I went for a different solution (I can't post the code here because of security limitations in my company).
We want to allow an initial value and have to allow [allowCustomer]="true" because that initial value is not initially a part of the [data] array since we fetch it from the server.
I simply pushed the initial value to the [data] array and that fixes it. no need for [allowCustome]="true"

Set option selection on mat-select to return placeholder after selection

I have the following Angular 6 code:
https://stackblitz.com/edit/angular-pl9wkw
I'm tryin g to make the select dropdown reset to the place holder once a selection has been made. I am using these two lines to try and reference the process:
#ViewChild('selectDropdown') selectDropdown: MatSelect;
and
this.selectDropdown.AppComponent.reset();
Alas, it does not work to set the dropdown back to the placeholder. I know that it can be set back to the placeholder, because I have the blank <mat-option></mat-option> selectable, and once you do select it, it sets it back to the placeholder.
Any thoughts ... anyone.
In your onChange method make the following change.
this.selectDropdown.value = [];
// this.selectDropdown.AppComponent.reset();
In your Onchange make following change
this.selectDropdown.value.reset();

How to Auotmate Combo box for makemytrip as I am able to insert the value but once the focus is moved value is erased from the combobox

How to Auotmate Combo box for makemytrip as I am able to insert the value but once the focus is moved value is erased from the combobox
Try use Click first on that WebEdit (or maybe WebElement) object. Then, use SendKeys method to insert desired value. One potential issue here is that the value may still disappear even you use SendKeys, if so, try to send the string one by one. Google has lots of sample codes about SendKeys and sending string one character by one character.
If it's a WebEdit object, you might find it works best if you use the WebEdit("whateveritscalled").Type myDestinationString operation rather than Set or SendKeys.
Try the following, I am setting the values using the Elementid,it should work-
Browser("MakeMyTrip, India's No").Page("MakeMyTrip, India's No").Object.getElementById("from_typeahead1").value = "New Delhi, India (DEL)"
Browser("MakeMyTrip, India's No").Page("MakeMyTrip, India's No").Object.getElementById("to_typeahead1").value = "Mumbai, India (BOM)"

How do you get Length of Text in a Mojo TextField?

How do you get the length of the text inside a Mojo TextField?
I'm trying to set a multiLine TextField with a limit of 150 chars, I tried doing it with a counter, but ran into a issue of not being able to decrement the counter when the text was erased, or adding the right number when pasting text, so my new approach was to get the length of the text each time you press a letter.
I've already tried this: (gets called in the charsAllow attribute of the textField)
if (this.controller.get("mensaje").mojo.getValue().length <= 150) {
return true;
}
this.controller.get("mensaje").mojo.blur();
return false;
but it doesn't work.... I debugged and the function exits just after the line in bold... it doesn't even returns true or false.
I also tried assigning the length value to a variable or assigning the text to a variable and then get the length, but nothing.
It's the same issue. It returns just after the getValue().
Also, maybe because of this issue, the text scrolls instead of wrapping, but when the textField loses focus it wraps the text.
If 'mensaje' is the HTML id of your text field, try getting it and using .innerHTML().length. In other words, work with the DOM element using Javascript/Prototype functions instead of the Mojo object.
My first guess would be that "this" isn't being passed into charsAllow properly. Did you .bind(this) the function you're passing as an argument?
I found this a little odd... the function mojo.getValue() actually works... but not from inside the function called by "charsAllow"..., and also, the function called by charsAllow can't call any other function, it just breaks out of the function doing nothing... does someone have a way to limit the chars in a MultiLine TextField??? (mojo textfield, to preserve the look :D). Thanks!!
this blog explains a bit about text fields might be useful:
http://kmdarshan.com/wordpress/?p=3305

Resources