Add Fields - Control Field length

Discussion in 'Customization & add-ons' started by mikeweeks, Nov 18, 2011.

  1. mikeweeks

    mikeweeks New Member

    Joined:
    Feb 16, 2010
    Messages:
    12
    Because I am using the data from aMember elswhere on the site and wish to display what the user enters I want to control the field length of what they enter.

    1 field is a postcode and needs to contain a maximum of 4 characters

    the second field is a description and needs to contain a maximum of 400 characters.

    Mike
  2. thehpmc

    thehpmc aMember Pro Customer

    Joined:
    Aug 24, 2006
    Messages:
    901
    How are users entering the data? If through a custom field then limit it this way.
  3. mikeweeks

    mikeweeks New Member

    Joined:
    Feb 16, 2010
    Messages:
    12
    I would if I knew how. Any pointers?
    Mike
  4. thehpmc

    thehpmc aMember Pro Customer

    Joined:
    Aug 24, 2006
    Messages:
    901
    HTML:
    <form method="post" action="As required">
    Postcode: <input type="text" size="10" maxlength="4" name="postcode" value=""> <br />
    Description: <input type="text" size="10"
    maxlength="400" name="description" value=""><br />
    
    <input type="submit" value="Send">
    </form>
    Quick example
  5. mikeweeks

    mikeweeks New Member

    Joined:
    Feb 16, 2010
    Messages:
    12
    Sorry I think you misunderstand where I am trying to do this. In aMember you can add fields to a members details and it is here that I want to control the length, not an html input form.

    Mike
  6. thehpmc

    thehpmc aMember Pro Customer

    Joined:
    Aug 24, 2006
    Messages:
    901
    Yes but how are the USERS entering the data, not directly into aMember database? If you permit this then you are asking for trouble.

    Normal method would be to have a form on your web page, that the users can use to enter information, limit what they can enter and then have it submitted to a php script (the 'action' of the form) and that script can sanitise the input, as required, and it then enters data in database.

    Entering data directly by outside users is a sure fire way to be hacked!!

Share This Page