#230 change the size of an custom_field

open
nobody
None
1
2013-10-21
2013-10-17
Anonymous
No

i have a custom input field (Editfield), i want to adjust the width to 10 or something else. There must be only 5 Chars.
i have tried this in the function create_field_entry_custom_field:

$params = array('label' => get_loc_field_name($tbl_entry, $key) . ":",
'name' => VAR_PREFIX . $key,
'value' => $custom_fields[$key],
'disabled' => $disabled,
'attributes' => "size=\"10\"",
'mandatory' => isset($is_mandatory_field["entry.$key"]) && $is_mandatory_field["entry.$key"]);

but nothing happens.
Where can i change the width for my inputfield?

Discussion

  • Campbell Morrison

    The width of the field is controlled by the CSS. However it sounds like you want to limit the number of characters that you will allow in the field, in which case I think you want to use the 'maxlength' instead of 'size' attribute.

    Campbell

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2013-10-17

    i want to limit the number of characters an adjust the size. where can i make these changes only for this one field?

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2013-10-18

    is there no way to adjust the size (width) from an input field?

     
  • Campbell Morrison

    Yes, you can do it via the CSS. Just add a rule such as

    .form_general input#your_field_id {width: 4em}

    If you're using 1.4.10 add it to the end of your mrbs.css.php file. If you're using the latest version from the trunk then you can now specify a custom css file in your config, so it would be better to do it that way.

    I'm also about to implement a change which will let you specify a maxlength for custom fields.

    Campbell

     
  • Campbell Morrison

    I've now implemented this in the trunk in Rev 2766

    Campbell

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2013-10-21

    many thanks!

    I have this .form_general input#your_field_id {width: 4em} at the end in mrbs.css
    But it dont works. I guess I need to replace this "your_field_id" with something, but with what?

    in the database my cutsom field is named: anzahl_personen
    Config.inc: $vocab_override['de']['entry.anzahl_personen'] = "Personenanzahl";

    i have tried this also: .form_general input#anzahl_personen {width: 4em}
    but nothing happens.

    i am using the version from 2013-06-10 16:47

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2013-10-21

    has done, I had to write a "F_" before the id.

    many thanks for the great support

     
  • Campbell Morrison

    Yes correct, though it should be "f_", ie lower case. (Mainly for the benefit of anybody else reading this).

    Campbell

     


Anonymous

Cancel  Add attachments





Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks