SourceForge has been redesigned. Learn more.

Input Textbox size

  • Medasha Govender


    I have a field that is defined as a string. In OX I defined the field as a character(25). I am able to capture 25 charaters on the screen. However the entire contents on the field is not displayed. I can only see 20 characters and I have to scroll to the right to see the rest of the characters. I don't want the user to have to scroll to see the text in the field. Is there a way to prevent this from happening ?

    Thanks for the help.


    Last edit: Medasha Govender 2013-01-03
  • Javier Paniza

    Javier Paniza - 2013-01-08

    Hi Med,

    OpenXava use the size of the Java property to set the size of the form field in HTML, so it should work fine.

    Put here the definition of your property in Java, the HTML code generated for your field (use FireBug or Chrome inspect element) and the example content you're using.

    Ask OpenXava questions on StackOverflow

  • Medasha Govender

    Hi Javier,

    The Warehouse example has the same problem.

    The warehouse name does not display all characters, e.g. if you enter all "W" is the warehouse name field it only displays 8 characters.

    I have tested using Google Chrome (which gives the same bug).
    The inspect element of the Warehouse name field is listed.

    Java Property:
    import javax.persistence.;
    import org.openxava.annotations.

    public class Warehouse {
    @Id @Column(length=3) @Required
    private int number;

    @Column(length=10) @Required
    private String name;

    public int getNumber() {
    return number;

    public void setNumber(int number) {
    this.number = number;

    public String getName() {
    return name;

    public void setName(String name) { = name;

    HTML Code generated

    <input type="hidden" name="ox_Management_Warehouse__name_EDITABLE_" value="true">
    <input id="ox_Management_Warehouse__name" name="ox_Management_Warehouse__name" class="form-text " type="text" tabindex="1" title="Name" maxlength="10" size="10" value="WAREHOUSE5" onblur="openxava.onBlur('Management','Warehouse','ox_Management_Warehouse__name')" onfocus="openxava.onFocus('Management','Warehouse','ox_Management_Warehouse__name')">

    Thank u.


    Last edit: Medasha Govender 2013-01-11
  • Javier Paniza

    Javier Paniza - 2013-01-14

    Hi Med,

    the HTML code is generated in the right way, using size="10 and maxlength="10". So, OpenXava does its work right. It's the HTML or your browser that does not show all characters when you use M or W, but it fills only half way if you use I.

    I think it is not a bug, but a design choice. Because, if you design to include a name with all W, most of the names would waste too much space. In any case, it's a design choice (or bug if you prefer) of your browser, not of OpenXava.

    Ask OpenXava questions on StackOverflow

  • Medasha Govender

    Hi Javier,

    Thanks for looking into this. Can you suggest any way that I can overcome this problem ? It's a bit cumbersome to have scroll to see the full contents of the field.

    Thanks for the assistance.



  • Javier Paniza

    Javier Paniza - 2013-01-16

    Hi Med,

    the simplest solution is just add more size to the fields.
    One solution is to use CSS to modify the letter spacing, wide, or so.
    Another solution is using CSS for specify the size of a concrete field. Because this problem is annoying only if the fields is always filled with wide letters.

    Also try readOnlyAsLabel=true in, maybe this option is better for your application.

    You can also try the @DisplaySize annotation.

    Ask OpenXava questions on StackOverflow


Log in to post a comment.