How to enable the input field when it comes to onfocus
Question

 I have used 4 input field, whenever i enter the value it should be focused to the next input field. Likewise when i give backspace it focus to the previous one. I used javascript, it was focusing to the next input field but it is not working for backspace.

SyntaxEditor Code Snippet

function backspace(){
var key = event.which||event.keyCode||event.charCode;
if(key==8){
 document.querySelector(".in1").focus();
}
else{
 document.querySelector(".in3").focus();
}
}
Solution

Hi Paulo Torres,

I have uploaded the oml for reactive.

Hope this helps!

Regards,

Ellakkiya.S



Focus.oml

Champion
Solution

Hi Ellakkiya,

I have attached the OML file, which contains the required javascript for changing focus. Check it and let me know if you need any more help on this.

Forum.oml

Pravi Gupta wrote:

Hi Ellakkiya,

I have attached the OML file, which contains the required javascript for changing focus. Check it and let me know if you need any more help on this.

Thankyou Pravi.,

Its working.


Hi Ellakkiya,

Did you receive any errors in your browser console when you are pressing backspace?

If not, are you able to go inside your function while pressing backspace in your application? I suggest yo to add some debugger or console.log() to investigate in which javascript line you are getting issue.

Let me know if you need some more information on this.

Regards

Palak Patel wrote:

Hi Ellakkiya,

Did you receive any errors in your browser console when you are pressing backspace?

If not, are you able to go inside your function while pressing backspace in your application? I suggest yo to add some debugger or console.log() to investigate in which javascript line you are getting issue.

Let me know if you need some more information on this.

Regards

Thankyou for your reply.,

No I didn't receive any error. I will  add debugger and investigate my javascript.


Champion
Solution

Hi Ellakkiya,

I have attached the OML file, which contains the required javascript for changing focus. Check it and let me know if you need any more help on this.

Forum.oml

Pravi Gupta wrote:

Hi Ellakkiya,

I have attached the OML file, which contains the required javascript for changing focus. Check it and let me know if you need any more help on this.

Thankyou Pravi.,

Its working.


Hi Pravi Gupta,

How I can implement this code in React?

Thanks in advance

Solution

Hi Paulo Torres,

I have uploaded the oml for reactive.

Hope this helps!

Regards,

Ellakkiya.S



Focus.oml

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.