+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: How can i stop people using caps in the title ?

  1. #1

    How can i stop people using caps in the title ?

    How can i stop people using caps in the title ?

    Maybe even in the listing description if all are caps it shouldnt be posted.

  2. #2
    Yeah its frustrating when people either use all capitals or none at all.

    There is a text-transform property for css but i think that either turns all letters to capitals or lowercase,

    text-transform:uppercase; (turns text to capitals)
    text-transform:capitalize; (turns first letter of each word to capital, but i think if someone typed all capitals it will stay as all capitals)
    text-transform:lowercase; (turns test to lowercase)

  3. #3
    To add error message and disallow to post it you can do following:

    open includes/rlCommon.inc.php

    find function checkDynamicForm

    Find case "text": there and at the bottom of the "case"

    just before
    Code:
    Only registered members can view the code.

    add code

    Code:
    Only registered members can view the code.
    it will show error for the field when they are only uppercase symbols.
    Error will say "the field is incorrect"

    To play with error message please change $GLOBALS['lang']['notice_field_incorrect']
    to notice_field_uppercase for example
    then through the languages manager add appropriate error message with key notice_field_uppercase and {field} inside the phrase body, it will be replaced with actual field name.


    It's just for text field, you can do the same for textarea field in the same function.


    Let me know if it's not clear or it's not working right.

  4. #4
    Gonna try it later today.

    Thanks

  5. #5
    Senior Member
    Join Date
    Dec 2023
    Posts
    161
    Thanks! This works great, except for one problem.
    When I add this to /includes/classes/rlCommon.class.php if one of the non-required text fields is empty (no text entered), it triggers notice_field_uppercase
    strtoupper(empty) matches empty.

    It works great if ALLCAPS is entered to show notice_field_uppercase, but how do I not trigger notice_field_uppercase if the field is simply empty?
    Last edited by Horizon; January 3, 2024 at 09:03 AM.

  6. #6
    Senior Member
    Join Date
    Dec 2023
    Posts
    161
    Also would there be an option if ALLCAPS is detected in a text field to simply rewrite the field to lowercase?

  7. #7
    Flynax developer Rudi's Avatar
    Join Date
    Dec 2014
    Location
    Planet Earth
    Posts
    3,174
    You need to make your text filed "required" to trigger an error that it's empty

    to automatically transform text to lowercase (with the first capital letter) instead of the code below use this:
    PHP Code:
    Only registered members can view the code

  8. #8
    Senior Member
    Join Date
    Dec 2023
    Posts
    161
    I don't necessarily want to make all text fields required though, as I have many optional ones.

    I suspect I need to wrap the above with an if not empty php statement ? but don't want to make a mistake.

  9. #9
    Senior Member
    Join Date
    Dec 2023
    Posts
    161
    [QUOTE=Rudi;38610]You need to make your text filed "required" to trigger an error that it's empty

    to automatically transform text to lowercase (with the first capital letter) instead of the code below use this:
    PHP Code:
    Only registered members can view the code
    /QUOTE]
    Thanks, this actually might be better. Instead of nagging users who enter ALLCAPS, I'll just convert it if entered ALLCAPS to Allgood

  10. #10
    Senior Member
    Join Date
    Dec 2023
    Posts
    161
    Hmmm, this doesn't seem to do anything
    Code:
    Only registered members can view the code.
    When adding or editing a listing, My ALLCAPS TEXT in either textarea or text remains ALLCAPS. What am I missing?
    Last edited by Horizon; January 3, 2024 at 09:46 AM.

+ Reply to Thread