XF 2.1 Please enter a valid value

Matt C.

Well-known member
I'm getting the following error messages when trying to add an entity:

Code:
Please enter a valid value.
Please enter a valid value.
Please enter a valid value.
Please enter a valid value.

I've double checked and made sure the values match up. Could someone through and check to see if something doesn't look right? Thank you very much

Here is my edit template:
HTML:
<xf:macro name="platform" arg-match="!">
    <xf:selectrow name="platform" value="{$match.platform}" label="{{ phrase('ah_mm_platform') }}">
        <xf:option value="Battle.net" label="{{ phrase('ah_mm_battlenet') }}"></xf:option>
        <xf:option value="PlayStation 4" label="{{ phrase('ah_mm_playstation_4') }}"></xf:option>
        <xf:option value="Xbox One" label="{{ phrase('ah_mm_xbox_one') }}"></xf:option>
    </xf:selectrow>
</xf:macro>

<xf:macro name="activity" arg-match="!">
    <xf:selectrow name="activity" value="{$match.activity}" label="{{ phrase('ah_mm_activity') }}">
        <xf:option value="Any">{{ phrase('ah_mm_any_activity') }}</xf:option>
        <xf:option value="Quick Play">{{ phrase('ah_mm_quick_play') }}</xf:option>
        <xf:option value="Competitive">{{ phrase('ah_mm_competitive') }}</xf:option>
        <xf:optgroup label="Arcade">
            <xf:option value="Mystery Heroes">{{ phrase('ah_mm_mystery_heroes') }}</xf:option>
            <xf:option value="Total Mayhem">{{ phrase('ah_mm_total_mayhem') }}</xf:option>
            <xf:option value="Team Deathmatch">{{ phrase('ah_mm_team_deathmatch') }}</xf:option>
            <xf:option value="3v3 Lockout Elimination">{{ phrase('ah_mm_3v3_lockout_elimination') }}</xf:option>
        </xf:optgroup>
        <xf:option value="Custom Game">{{ phrase('ah_mm_custom_game') }}</xf:option>
        <xf:option value="Clan/Team Recruitment">{{ phrase('ah_mm_clan_team_recruitment') }}</xf:option>
    </xf:selectrow>
</xf:macro>

<xf:macro name="role" arg-match="!">
    <xf:selectrow name="role" value="{$match.role}" label="{{ phrase('ah_mm_role') }}">
        <xf:option value="DPS">{{ phrase('ah_mm_dps') }}</xf:option>
        <xf:option value="Tank">{{ phrase('ah_mm_tank') }}</xf:option>
        <xf:option value="Support">{{ phrase('ah_mm_support') }}</xf:option>
        <xf:option value="Flex">{{ phrase('ah_mm_flex') }}</xf:option>
    </xf:selectrow>
</xf:macro>

<xf:macro name="region" arg-match="!">
    <xf:selectrow name="role" value="{$match.region}" label="{{ phrase('ah_mm_region') }}">
        <xf:option value="Any">{{ phrase('ah_mm_any_region') }}</xf:option>
        <xf:option value="Americas">{{ phrase('ah_mm_americas') }}</xf:option>
        <xf:option value="Europe">{{ phrase('ah_mm_europe') }}</xf:option>
        <xf:option value="Asia">{{ phrase('ah_mm_asia') }}</xf:option>
    </xf:selectrow>
</xf:macro>

<xf:macro name="level" arg-match="!">
    <xf:textboxrow
        name="level"
        label="{{ phrase('ah_mm_level') }}"
        type="match"
        value="{$match.level}"
        placeholder="{{ phrase('ah_mm_level') }}"/>
</xf:macro>

<xf:macro name="skill_rating" arg-match="!">
    <xf:textboxrow
        name="level"
        label="{{ phrase('ah_mm_skill_rating') }}"
        type="match"
        value="{$match.skill_rating}"
        placeholder="{{ phrase('ah_mm_skill_rating') }}"/>
</xf:macro>

<xf:macro name="voice" arg-match="!">
    <xf:checkboxrow label="{{ phrase('ah_mm_microphone') }}">
        <xf:option name="voice" checked="{$match.voice}"
            label="{{ phrase('ah_mm_do_you_have_a_microphone') }}" />
    </xf:checkboxrow>
</xf:macro>

<xf:macro name="username" arg-match="!">
    <xf:textboxrow
        name="match_username"
        label="{{ phrase('ah_mm_username') }}"
        type="match"
        value="{$match.match_username}" />
</xf:macro>

<xf:macro name="description" arg-match="!">
        <xf:textarearow name="description" value="{$match.description}" data-min-height="200" label="{{ phrase('description') }}" />
</xf:macro>

Here is the schema:
PHP:
$structure->columns = [
    'match_id' => ['type' => self::UINT, 'autoIncrement' => true],
    'platform' => ['type' => self::STR,
        'allowedValues' => [
            'Battle.net', 'PlayStation 4', 'Xbox One'
        ],
    ],
    'activity' => ['type' => self::STR,
        'allowedValues' => [
            'Any', 'Quick Play', 'Competitive',
            'Mystery Heroes', 'Total Mayhem', 'Team Deathmatch', '3v3 Lockout Elimination',
            'Custom Game', 'Clan/Team Recruitment'
        ],
    ],
    'role' => ['type' => self::STR,
        'allowedValues' => [
            'DPS', 'Tank', 'Support', 'Flex'
        ],
    ],
    'region' => ['type' => self::STR,
        'allowedValues' => [
            'Any', 'Americas', 'Europe', 'Asia'
        ],
    ],
    'level' => ['type' => self::STR,
        'required' => 'ah_mm_please_enter_your_level'],
    'skill_rating' => ['type' => self::STR,
        'required' => 'ah_mm_please_enter_your_skill_rating'],
    'voice' => ['type' => self::BOOL, 'default' => false],
    'match_username' => ['type' => self::STR,
        'required' => 'ah_mm_please_enter_your_username'],
    'description' => ['type' => self::STR,
        'required' => 'ah_mm_please_enter_the_match_description'
    ],
    'match_date' => ['type' => self::UINT, 'default' => \XF::$time],
    'user_id' => ['type' => self::UINT, 'default' => '0'],
    'username' => ['type' => self::STR, 'maxLength' => 250,],
    'warning_id' => ['type' => self::UINT, 'default' => 0],
    'warning_message' => ['type' => self::STR, 'default' => ''],
    'match_state' => ['type' => self::STR, 'default' => 'visible',
        'allowedValues' => ['visible', 'moderated', 'deleted'], 'api' => true
    ],
    'archived' =>  ['type' => self::BOOL, 'default' => 'false']
];
 
Last edited:
'user_id' => ['type' => self::UINT, 'default' => '0'],
Type is set to unisgned integer but you're setting default value to '0' which is string.
'archived' => ['type' => self::BOOL, 'default' => 'false']
Again, default value is set to a string which does not match with you've set for column value type.

OT:
'role' => ['type' => self::STR, 'allowedValues' => [ 'DPS', 'Tank', 'Support', 'Flex' ], ],
Might want to breakdown the roles into Primary-DPS, Flex-DPS, Main-tank, Off-tank, Main-support and Flex-support.

'region' => ['type' => self::STR, 'allowedValues' => [ 'Any', 'Americas', 'Europe', 'Asia' ], ],
Also change it to North America, South America, South Africa, Europe, SEA, South Korea and OCE. Why? Well because people at Blizzard thought it is totally fine to put Singapore, Australian and South American servers in Americas region because nothing feels better than playing McCree or Widowmaker at 280 ping right?
 
Type is set to unisgned integer but you're setting default value to '0' which is string.

Again, default value is set to a string which does not match with you've set for column value type.

OT:

Might want to breakdown the roles into Primary-DPS, Flex-DPS, Main-tank, Off-tank, Main-support and Flex-support.


Also change it to North America, South America, South Africa, Europe, SEA, South Korea and OCE. Why? Well because people at Blizzard thought it is totally fine to put Singapore, Australian and South American servers in Americas region because nothing feels better than playing McCree or Widowmaker at 280 ping right?

Thank you, I made the changes you suggested. I'm not going to change the values though until I figure out what's wrong.

I found that if I remove swich the columns to varchar from enum, then they work.

191642]\

Are any of these wrong?
 
I just figured out the problem, I'm such an idiot.

Code:
$platform = $this->filter('platform', 'str');
$activity = $this->filter('platform', 'str');
$role = $this->filter('platform', 'str');
$region = $this->filter('platform', 'str');
$level = $this->filter('platform', 'str');
$skill_rating = $this->filter('platform', 'str');
 
You might want to not hard-code the activity and role phrases like that. By using actual words instead of keywords, it'll be harder for code to read (case sensitivity is not uniform across all OSes) and also it makes it impossible to translate them.

Consider using something like any, quick_play, competitive, etc instead. Then in your templates, use an elseif chain to properly phrase them :)
 
Top Bottom