Skip to:
Content
Pages
Categories
Search
Top
Bottom

adding maxlength, no greater to custom profile field?

  • hello,
    Any help to this would be great i’m new to buddypress and I am trying to add a custom Profile Field, a post code to be precise. I want to add a max length to the profile field and limit the number combinations so users can only input the follwoing numbers 1000 through to 1199 and two letters aa through to zz..
    I’ve been searching through the bp xprofile folder but cant seem to find where the custom fields are being added from.
    any help would be great and much appreciated

    `<option value="textbox" maxlength="4" type == ‘textbox’ ){?> selected=”selected”>`

    This is what i’m tring to limit the maxlength but i cant seems to get it to work
    if some one could point me towards a open ticket that explains this I would much appreciated.
    Chris

Viewing 7 replies - 1 through 7 (of 7 total)
  • BUMP
    IF THIS HELPS!
    I’m currently running
    WordPress 3.4.1
    buddypress 1.6
    installed as a directory on root
    using default theme
    no modifications of corefiles
    no custom feature of bpcustom
    hosted with argeweb.
    running on linux

    bump please!!!

    is this question posted in the wrong section?


    danbpfr
    Participant

    @chouf1

    No you’re at the right place ;-)
    Answer from @JJJ here (since BP 1.3):
    https://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/custom-profile-field-limit-to-5-numbers/

    And BP 1.6 introduces ‘multi_format’ parameter to xprofile_get_field_data(), so that themers can return comma-separated values as an option (source: BP codex)

    But no idea at this time (no doc for this in codex) on how to use this in your case. Sorry.
    Try to ask @modemlooper ?


    shanebp
    Moderator

    @shanebp

    afaik – this is an html issue.
    textbox ignores maxlength – it only works on type=input.

    You can use javascript to limit the length of text entered into a textbox.

    But if you’re only allowing 4 number and 2 letters – you should use a input field anyways.
    And you’ll probably want to use javascript to check for the allowed char types and number of character types.


    danbpfr
    Participant

    @chouf1

    @shanebp, you’re right: it’s a html issue. This was what i first thinking too, but i searched around for some other solution and found JJJ’s answer. (see link in previous post)

    Why using a supplementary JS script when the possibility is given to use a unique ID field buited in BP’s xprofile routine ?


    shanebp
    Moderator

    @shanebp

    I’d like to see an example using an ‘unique ID field buited in BP’s xprofile routine’ that does a client-side check for length and characters.

    It would be very useful.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘adding maxlength, no greater to custom profile field?’ is closed to new replies.
Skip to toolbar