+ Reply to Thread
Results 1 to 6 of 6

Thread: force numeric year entry to four digit year

  1. #1
    Senior Member
    Join Date
    Dec 2023
    Posts
    161

    force numeric year entry to four digit year

    Is there a way to require a numeric field year to be input as 4 digits instead of 2?

    So users have to enter 1990 instead of 90

  2. #2
    Flynax developer Rudi's Avatar
    Join Date
    Dec 2014
    Location
    Planet Earth
    Posts
    3,174
    You can try to edit this code: includes/classes/rlCommon.class.php > fieldValuesAdaptation

    replace:
    PHP Code:
    Only registered members can view the code
    with:
    PHP Code:
    Only registered members can view the code

  3. #3
    Senior Member
    Join Date
    Dec 2023
    Posts
    161
    Thanks! OK, I need to go back one step I think.

    The field will contain (only) a 4 digit year, such as 1990.

    Should the field type be created as "numeric" or "date"?

  4. #4
    Flynax developer Rudi's Avatar
    Join Date
    Dec 2014
    Location
    Planet Earth
    Posts
    3,174
    If you need to use only years, you should create a Dropdown field and link it to Years Range

  5. #5
    Also you can create a new field with type number or date and use it.
    Viktor,
    Flynax technical department,
    Best wishes.

  6. #6
    Senior Member
    Join Date
    Dec 2023
    Posts
    161
    Quote Originally Posted by Rudi View Post
    If you need to use only years, you should create a Dropdown field and link it to Years Range
    Ah that makes sense. It's not quite as quick for the seller to select the year from the dropdown as typing the number, but it works to make sure the user enters something sensible!

+ Reply to Thread