I have the following code within a model
rules()
{
....
array('new_pass', 'length', 'min'=>6, 'max'=>64, 'tooShort'=>'Password is too short (minimum is 6 characters)'),
....
}
When I input a value that is between 1 and 5 chars long it errors saying it is too short. But if I leave it blank it updates? I'm not sure how to fix this or more importantly why it would let a blank value in.
I tried adding in a allowEmpty, that stopped it updating a password that was 0 length in chars but when I tried to then save the model with a 6+ length password it then error'd saying Password too short'
Any help greatly appreciated
Jonny
As i understand its changepassword action so just add rule:
rules()
{...
array('new_pass','required','on'=>'youraction')
...}
But still 'allowEmpty'=>false' must work for this.
you didn't add tooLong, then try it again
Related
I'm trying to find a way to to exclude one field input in my form that is disabled and contains the value of a users ID number
I would like to know how I can tweak this.$refs.form.reset(); because it works perfectly but it clears EVERYTHING and I wish to contain the ID value and resets the rest of the fields like name surname age income etc
The reason why I the ID is important is that the user gives this in a sign-up step at the start and this form that I am talking about is located somewhere else to complete his profile I don't want to ask the user again to type his ID in again.
If anyone knows how to accomplish this it would be a great help
The reset method of the form simply looks at all the inputs bound to it and resets each one within a loop then empties the error bag, observe:
reset (): void {
this.inputs.forEach(input => input.reset())
this.resetErrorBag()
},
There's no reason you can't do the same, except for when they're disabled:
resetForm() {
this.$refs.form.inputs.forEach(input => {
if (!input.disabled) {
input.reset()
}
})
this.$refs.form.resetErrorBag() // necessary to remove validation errors after the field values are removed
}
Then you can call that function (against your Vue instance, not your VForm) with this.resetForm() and it should work out the way you want.
Disclaimer: Can't test it at the moment. input.disabled may not be readily available and may require further inspection of the input element.
I am trying to write an autohotkey script to fill an online forum using COM. My problem is that the username is incremented by numbers, so ideally I want to loop the script to fill the form 5 or 6 times.
Here is the autohotkey part I am struggling with:
number := 28
username = user%number%
wb.document.all.getElementById(username).value := "username" ;HERE IS THE PROBLEM
number++
I have tried %username%, username without quotes, and with single quotes, and nothing seem to be working.
any ideas?
Thanks for your help.
First thing that popped out to me was all in you, I see Joe DF asked if you had tried without?
Second thing is you shouldn't have ""'s around your Variable.
If you are doing multiple assignments you can enclose them in ()'s like so:
:= (UserName "`n" Address "`n" PhoneNumber "`n" SocialSecurity)
If you are having problem's with a document not fully being loaded you can implement a custom loading routine like so:
wb.Navigate("Yourwebsite")
GoSub loading
.
.
.
loading:
ComObjError(false) ;turn off com errors
While value = "" {
value := wb.document.getElementsByClassname("somethingHere") [0].innerText
Continue
}
ComObjError(true)
Return
Without seeing more of your code and the website you are trying to work with, it will be difficult to help you further.
It worked... turns out it was the sleep time for the form to load. form was slower than Sleep 100 for some reason. Now, the form loads, but it is only taking 1 field. so password and email are not being filled.
I am going to a field, entering text, saving it, then going back to verify the value is still in the field.
$I->waitForText is not working. Not sure why. I am trying the following but getting the error below:
$I->canSeeInField("//form[#id='Foo']/table/tbody/tr[3]/td[3]/textarea", "123");
Sorry, I couldn't see in field "//form[#id='Foo']/table/tbody/tr[3]/td[3]/textarea","123":Failed asserting that two strings are equal.
Any ideas?
Thanks
If you are using WebDriver, you can just debug your page using makeScreenshot()
You can just use:
$value = $I->grabFromField('//form[#id='Foo']/table/tbody/tr[3]/td[3]/textarea');
and fill other fill with your value:
$I->fillField('#your_field_id', $value);
and than, just make a screenshot:
$I->makeScreenshot('name_of_your_screenshot');
Now check your debug folder with your image.
I am working in MVC4 Razor. For masking i am using "jquery.inputmask.js". I am facing following issue by using this :
Problem
1.) Saving Integer with maxlength = 4 of input box (Integer type)
If i insert all digits like 1231 then it is working fine but if i leave this field with partial fill then i am getting output like this 23___ when i click outside the input box input box become empty.
2.)Saving Double with mask value "99.9" (Double type)
In this case if i fill value like 08.9 and save it then i am getting output like 89._ which is invalid for double.
Before asking here i had done some homework and find out some links :
http://www.decorplanit.com/plugin/
http://www.texotela.co.uk/code/jquery/numeric/
How i can overcome these cases?
$('#Name').focusin(function () {
$('#Name').mask("?99.99%");
});
Add ? and it resolved your problem.I am facing same situation and adding ? first it
resolved this issue.
Demo :http://jsbin.com/UHOJopaY/1/edit
I have the following snippet of code for auto expanding the textarea in sencha touch. I need to cap it out at a set number of rows.
Any ideas?
http://www.senchafiddle.com/#Q9gjN
Wouldn't this be great if it were a nice, easy to use property.
At first I thought it would be the maxRows property but this is just the number of rows to display before the vertical scrollbar appears.
It may be that the only way would be a complicated solution such as this: http://www.codeproject.com/Articles/56392/How-to-Limit-the-Number-of-Lines-and-Characters-in
or
Limiting number of lines in textarea
EDIT: I needed to cap the number of rows in an address to 5 lines.
One approach could be to listen to the keyup event on the textareafield, check for the 'Enter' key and then revert back to previous input.
The approach I have taken is just to add validation to the model, which works great.
{ type: 'format', field: 'Address', message: 'Address cannot be more than 5 lines.', matcher: /^([^\r\n]{0,50}(\r?\n|$)){5}$/ }
The regex restricts saving a record to the store that has more than 5 lines, of more than 50 chars.