I ask your help Everybody. :-)
Here is a link to Playground.
The problem you can see if to look at the console or debug log.
If you fill the text fields and press "Enter" key, you can see that only the first field can get the value. Second one is NULL.
If you tap "Enter" key second time - there is no problem at all.
But if you clean fields and fill it up again - the same problem will be back.
If I use just a button with "execute" event - there is no problem.
Is it a bug or something wrong about my code?
I think the problem is that the changed value of the textfield is applied to the model only when the textfield looses focus (or after you pressed Enter). So yo have to set the liveUpdate property to true. Here is your playground example updated.
var userPhone = new qx.ui.form.TextField().set({
required: true,
placeholder: "00123456789",
liveUpdate : true
});
Related
I have a list of checkboxes in my React App. When I hold Shift key and click one - the others between current and the nearest checked one should become selected.
For now I'm tring to do somethimg like this:
<input onChange={(e)=>this.handleCheckbox(e)} value={id} checked={this.state.selected.IndexOf(id) > -1} type="checkbox" />
handleCheckbox(e){
if(e.shiftKey){
console.log("shiftKey is hold")
}
//here goes some logic to save checkboxes in the state
}
But the condition if(e.shiftKey) is never executed. What am I doing wrong?
For future visitors:
To check if the Shift key is pressed, check the e.nativeEvent.shiftKey in the click event.
You still have to implement the logic for actually checking the boxes. If you need help with that, let me know.
Hope this helps.
onChange is trigged after you let the key up. You should use the onKeyDown event.
I am setting input field to invalid from javascript like this:
$scope.formName.fieldName.$setValidity("string", false);
This is working, but it affects the view only after clicking in a input field and then clicking out of it.
How can I change it in order to see the invalid field immediatelly?
You'll need to attach an ng-change="checker(model)" to your input field. Then just apply an ng-class to it to check for formName.fieldName.$error.string (since you put string as the error key) or you can also do formName.fieldName.$invalid && !formName.fieldName.$pristine
I've attached this codepen for you to play around with and see how to apply an invalid class on the field without having to lose focus on it.
Hope that helps!
So i am querying the user for input to save a document that they are writing. I want the first letter of the input to be a capital letter - by automatically toggling on the capital "up" arrow when the keyboard is shown. I have the following code:
AlertIOS.prompt('Saving Document',
'Please name this document',
[{text: 'Cancel'},
{text: 'Save', onPress: input => this._saveFile(input)}
]
)
Just wondering how i can do so. I realise that i can edit the input in the back end and capitilize the first letter there, but i am looking for a method in which the user can see that the first letter is a capital when entering input.
Most IOS apps have this feature and i was wondering how to do so in react native.
Thanks in advance.
As the comments say, at the moment there is no way to do this with the AlertIOS component, at least not without getting into native code. But take a look at https://www.npmjs.com/package/react-native-prompt, it appears this might have the functionality you are looking for. You should be able to set the autoCapitalize prop on the textInput using this property:
textInputProps (Object) -- Additional props on the input element
I have run across a weird/confusing behavior with <input> and form validation.
Essentially, if input has an invalid numeric value (which sets form.$valid to false), if a model value is changed to null, it sets the $valid flag back to true, but doesn't change the value displayed in the input field.
I have created a plunker to illustrate. Follow these steps to reproduce:
Modify value of a cell to empty.
Click on save link (which saves null into model)
Input a non-numeric character.
Click on reset link (which restores null from model)
Observe that the input field is no longer invalid, but the invalid character is still there.
Is this a bug or am I doing something wrong?
EDIT:
I'm starting to believe that it is a bug. I "fixed" it by introducing another directive that forces "" value for null.
Here's a fork of the plunker above with the "fix".
EDIT2:
This was fixed in v1.3+
You code is working fine but you forgot to add a validation check at app.js
this.save = function(){
if($scope.mainForm.$valid && !this.get() == ""){
old_num = num;
}
};
You should only save the value when the form is valid.
However that is not a full prove solution as the entire form has to be valid in order for save to work. To further improve the algorithm, i suggest that you mark the validity of individual model and you check validity to the individual model.
Hope it helps
Had a similar problem, I solved it by first doing:
form.$rollbackViewValue() or form.field.$rollbackViewValue if it was .$invalid before doing any of my other reset code.
In your example, you could change to something like:
<button class="btn btn-link" ng-click="cellForm.$rollbackViewValue(); item[prop].reset()">reset</button>
I have a PDF form and I need to prevent printing this PDF form, if its fields are blank.
To modify my form i user Adobe LiveCycle Designer ES3.
About how can this be done is written here: http://forms.stefcameron.com/2008/04/13/prevent-printing-pdf-forms-in-acrobat-8/
The only thing i need more than in this article - is to suppress message "Printing Cancelled", or overide it with another text.
So, if somebody knows how can it be done, please help me.
Do you a print button on the form which is being clicked to print the form ?
If you do, then there is a way to suppress the printing. Otherwise, I don't know of any way of solving your issue.
If you do have a print button, add the following code to the click event of the button:
var result = form1.MainPage.execValidate();
if(result==false){
xfa.host.messageBox("Please ensure that all validations are complete before printing.");
}
else{
xfa.host.print(1, "0", (xfa.host.numPages -1).toString(), 0, 0, 0, 0, 0);
}
Where "form1" is the rootnode of the form and "MainPage" is the page which contains all the subforms in your form. the exeValidate() method fires all the validation messages in the form and returns a true if the all validations pass the test. Otherwise it returns false.
Pleaselet me know if you have any other questions.
Thanks,
Armaghan.
Set your event picker to "PrePrint", Add your validation script.
Enter : xfa.event.cancelAction = (true) at the end of your "If" statement.