I did show alert and commented that out but it made no difference.
I did show alert and commented that out but it made no difference.
// alert("Value must be between 0 and 5")
$(this).val(null);
$(this).get(0).focus();
That's my code the value gets set to null but the focus does not do anything.
Wierd
$(this).val(null); is wrong way to clear input. Use $(this).val( "" ); for this.
I create simple app, added two inputs. For first input I create Value change event action with code: prevar inputValue = $(this).val();
inputValue = parseInt(inputValue);
if (Math.floor(inputValue) == inputValue) {
if (inputValue < 0 || inputValue > 5) {
alert("Value must be between 0 and 5")
$(this).val("");
$(this).get(0).focus();
};
} /pre
And that works for me -- I can't move focus to second field if I enter something different than 0..5.
I set the val to an empty string rather than null.
Same thing happens.
The only difference is that my Input controls are connected to a grid that's connected to a datasource and gets created dynamically.(I explained that at the beginning of this thread.
Thanks for the help.
If I get it to work I'll let you know.
Code must work. Do you have errors in console?
Can you give me a public link to your app? Or you can share it with a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a.
.I'm not the owner of the app. My colleague is.
I will login as him and share it with a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a
The app is called SanteCeleste. His Appery ID is "a href="mailto:christo@computersetcetera.co.za" rel="nofollow"christo@computersetcetera.co.za/a" Name Christo Du Preez
The form where the problem is is called "DiagnosticDoSelected"
When you test the App us screen size 480 x 800 and -
Press the "Login to Sante Celeste" button'
Then on the Subscriber home screen click "*Dignostics" button'
Then on the "Self Diagnostic Tool" Screen click the "Do Self Diagnostic Test" button.
Select the first item "Indigestion" which will take you to the "DiagnosticDoSelected" screen.
The severity column is where the problem occurs.
Go to the Abdominal Pain line and set the Sevirity to 7 and hit the tab button or click elsewhere. You will see the problem.
Hope my instructions make sense.
I have shared the app with Support
Can you send public link to a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a?
Unfortunately, I can find only Phyzio shared with a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a from Christo Du Preez.
Oh dear.
I have now shared Sante-Celeste with support@appery
Sorry about that.
So, If I change your code to this (in my backup of your project):
prevar inputValue = $(this).val();
inputValue = parseInt(inputValue, 10);
if (Math.floor(inputValue) == inputValue) {
if (inputValue < 0 || inputValue > 5) {
alert("Value must be between 0 and 5")
Code: Select all
$(this).val("");
this.focus();
};
} else {
alert("value is not an Integer");
$(this).val("");
this.focus();
}/pre
I have normal refocusing on input. Your version have typo "$(this).set(0).focus()". And "this.focus();" is the same as $(this).get(0).focus()