WordPress.org

Making WordPress.org


Ignore:
Timestamp:
11/22/17 23:09:15 (8 weeks ago)
Author:
coreymckrill
Message:

WordCamp Post Type: Add note about number formatting

Sanitizing floats with variable comma and decimal point locations
(depending on the locale conventions of the user) turns out to be
quite a challenge. For today, we're going to take the easy way out
and just add a note to the input instructing to not use commas.

This also adds attributes to the number input field to make it more
compatible with a variable number of decimal points.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-admin.php

    r6158 r6160  
    11521152    // @todo When you refactor meta_keys() to support changing labels -- see note in meta_keys() -- also make it support these notes 
    11531153    $messages = array( 
    1154         'Telephone'                => 'Required for shipping.', 
    1155         'Mailing Address'          => 'Shipping address.', 
    1156         'Physical Address'         => 'Please include the city, state/province and country.', // So it can be geocoded correctly for the map 
    1157         'Global Sponsorship Grant' => 'Deprecated.' 
     1154        'Telephone'                       => 'Required for shipping.', 
     1155        'Mailing Address'                 => 'Shipping address.', 
     1156        'Physical Address'                => 'Please include the city, state/province and country.', // So it can be geocoded correctly for the map 
     1157        'Global Sponsorship Grant Amount' => 'No commas, thousands separators or currency symbols. Ex. 1234.56', 
     1158        'Global Sponsorship Grant'        => 'Deprecated.', 
    11581159    ); 
    11591160 
     
    11911192                        case 'number' : ?> 
    11921193 
    1193                             <input type="number" size="16" name="<?php echo $object_name; ?>" id="<?php echo $object_name; ?>" value="<?php echo esc_attr( get_post_meta( $post_id, $key, true ) ); ?>"<?php echo $readonly; ?> /> 
     1194                            <input type="number" size="16" name="<?php echo $object_name; ?>" id="<?php echo $object_name; ?>" value="<?php echo esc_attr( get_post_meta( $post_id, $key, true ) ); ?>" step="any" min="0"<?php echo $readonly; ?> /> 
    11941195 
    11951196                        <?php break; 
Note: See TracChangeset for help on using the changeset viewer.