I'm developing a program that will be used to work with a Barcode Scanner. By default, the device was adding a carriage return at the end of scanned code. I was thinking to add an "Enter" keystroke in my controller but no luck.
How will I execute the controller by simply pressing enter key in a textfield?
Thank you!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Help others in this forum as I help you.
Before posting a question search this forum for the answer,
and read the OpenXava documentation in openxava.org.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
My view contains only 1 writable text field and the rest are read only text fields
So, if you put the focus and the writable field and press enter the default action is not executed?
Create a miniproject with only an simple entity, a custom action and a controller. Then try to reproduce your case on it. If it fail put here the source code for the entity, action and controller. I will give some advice.
Help others in this forum as I help you.
Before posting a question search this forum for the answer,
and read the OpenXava documentation in openxava.org.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The action just works, but only with fields from Entity class. That's it, "by-default" actions only works with fields generated from Entity class. My problem is that I'm working with text field from a Transient class.
I tried your code and you're right, the action is not executed on RETURN. The problem is not because the class is transient but because the property is int.
It's an OpenXava bug, the return is not recognized for int textfields. Please, add the bug and we'll fix it in future OX releases.
In the meantime use String for your number property.
Help others in this forum as I help you.
Before posting a question search this forum for the answer,
and read the OpenXava documentation in openxava.org.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I'm developing a program that will be used to work with a Barcode Scanner. By default, the device was adding a carriage return at the end of scanned code. I was thinking to add an "Enter" keystroke in my controller but no luck.
How will I execute the controller by simply pressing enter key in a textfield?
Thank you!
Hi Erieze,
You have to define your action as the default one, in this way:
Hava a look at the doc of action in wiki.
Help others in this forum as I help you.
Before posting a question search this forum for the answer,
and read the OpenXava documentation in openxava.org.
Hello!
I already added "by-default" action to my controller but still not working with ENTER key.
My view contains only 1 writable text field and the rest are read only text fields.
I tried other view and it only works at List view (filtering).
Hi Erieze,
So, if you put the focus and the writable field and press enter the default action is not executed?
Create a miniproject with only an simple entity, a custom action and a controller. Then try to reproduce your case on it. If it fail put here the source code for the entity, action and controller. I will give some advice.
Help others in this forum as I help you.
Before posting a question search this forum for the answer,
and read the OpenXava documentation in openxava.org.
Hello Javier,
The action just works, but only with fields from Entity class. That's it, "by-default" actions only works with fields generated from Entity class. My problem is that I'm working with text field from a Transient class.
This is my Transient class code looks like,
Hi Erieze,
I tried your code and you're right, the action is not executed on RETURN. The problem is not because the class is transient but because the property is int.
It's an OpenXava bug, the return is not recognized for int textfields. Please, add the bug and we'll fix it in future OX releases.
In the meantime use String for your number property.
Help others in this forum as I help you.
Before posting a question search this forum for the answer,
and read the OpenXava documentation in openxava.org.
Hello Javier,
It is now working with Data type of String. Thank you very much!
And also I forwarded the bug to "bugs section".
Again, Thank you very much!
Hi Erieze,
The best way to give me thanks is helping others in this forum.