IONIC 4 Setting Max value that can be inputted - input

I want to limit the user input in ion-input to just 1000, not the max length of the user input.
How do I achieve that?

You set this "maxlength" property
like, This
<ion-input type="text" maxlength="1000"></ion-input>

You should use a size prop
<ion-input type="text" size="1000"></ion-input>

For anyone who stumble on the same problem with me, I found the solution by using 'max' Validators. You can about all available Validators here:
Angular Validators

Related

Vue 3: Conditional v-if on hmtl attributes

I'm trying to conditional rendering an HTML Elements attribute:
EG:
<InputNumber v-model:value="example[index].number"
:min="collector.attr[0] ? collector.attr[0] : 0"
:max="collector.attr[1] ? collector.attr[1] : 0"
:step="0.01"
style="min-width: 120px;"/>
The Problem: the minimum Value of 0 is set (collector.attr[0] = null), but I want eg. that user is able to enter '-100'
The Goal: if the collector.attr[1] is "null" i want to remove the ":min" attribute - resp. only allow this attribute, if there is a minimum value set.
Like so:
<InputNumber
v-if="collector.attr[0]" => then :min="collector.attr[0]"
/>
Thank you very much for your help :)
Probably you can set a minimum value beyond which a user is not expected to input anything. Something like this
<InputNumber :min="collector.attr[0] ? collector.attr[0] : -Number.MAX_VALUE" />
Where Number.MAX_VALUE is maximum allowed float value in java script, so adding - in it makes it negative.

Vue.js: How to initially check one of the radio button?

I am using the following code to generate radio buttons in my template.
<template v-for="(property,index) in propertiesList">
<input type="radio" :value="index" v-model="picked2"
:checked="property.checked">{{property.address}}<br>
</template>
property.checked has value of checked for one of the rows, and is null for rest of rows. I want to show the corresponding row (with property.checked = 'checked') as checked when the page is rendered. However, all rows appear as unchecked. Could someone please advise how to fix the issue? Thanks.
#Bret has provided the answer in the comment (to my question).

In Selenium Webdriver, how to get an input element after a text?

In my case, there are some legacy web sites, in which not all the inputs have
id attribute properly set. Such as this:
<div class="form-group">
<label>Amount</label>
<input id="unreasonablename" type="text" value=""></input>
</div>
But human testers can still test it by typing amount value in the input right behind "Amount". I'd like to make web driver do the same thing:
webDriver.inputAfter("Amount", 100); //I do not want to use "unreasonablename" to find the input.
But how can I find the input element after the text "Amount"? Thanks.
There is a relative question here: In Selenium Webdriver, how to get a text after an element?. But I'm not familiar with xpath and do not know if my case can be solved in the same way.
To find the <input> element just after the text Amount you can use the findElement() method along with the Locator Strategy as follows :
webDriver.findElement(By.xpath("//label[contains(.,'Amount')]//following::input[1]"));
you can try following_sibling as
webDriver.findElement(By.xpath("//*[text()='Amount']/following-sibling::Input"));
try this :
driver.findElement(By.xpath("//label[text()='Amount']/following-sibling::input")).sendKeys("amount to be sent");
you can write some generic method like below. It can be used for all the required fileds by passing the label name and input value as argument
void enterInputAfterLabel(String labelname,String value){
driver.findElement(By.xpath("//label[text()='"+labelname+"']]/input")).sendKeys(value);
}

Why I can't set my Dojo DateTextField?

I am trying to open a form having a DateTextField which must be populated with record from database. And I am having no luck of doing it. I already test my code this way :
dijit.byId("jurnal_date").attr("value", new Date(2011,1,1))
Just to test the basic way of setting a DateTextField. But the value won't get entered into DateTextField. What did I do wrong? Here is the DateTextField declaration:
<input type="text" name="jurnal_date" id="jurnal_date" required="true" dojotype="dijit.form.DateTextBox" />
Thanks!
Ah, I just resolved my own problem. Here is the answer :
newJournalDialog.show();
dijit.byId("jurnal_date").attr("value",dojo.date.stamp.fromISOString(jurnal.date))
So, we can only set the value of a DateTextField, after its dialog/form is shown.
Well, this is my conclusion after solving this problem :)
Thanks.

How can I set the initial value of a dijit.form.DateTextBox to today?

I've created a DateTextBox like:
<input dojoType="dijit.form.DateTextBox" constraints="{max: Date.now()}" id="startDate" />
When the page loads there is no value in the field. I would like the value to default to today. Is there a way to handle this? I know I could use the "value" attribute and set it in the declaration, but that only allows me to put a static date in the field, not a dynamic date.
It would also be good if the solution works with a form reset too.
Thanks for the help!
The parser supports the "now" keyword, so you could do:
<input dojoType=dijit.form.DateTextBox value="now">
Of course, for programmatic creation you would simply do:
new dijit.form.DateTextBox({value: new Date()})
Your solution:
<input dojoType=dijit.form.DateTextBox value="now">
If you want to make the date other than today:
<input dojoType=dijit.form.DateTextBox value="now" constraints="{max: new Date()}">