Notice

The forum is in read only mode.

Support Forum

Welcome! Support Forums have been reactivated
Welcome the Technical Support section. Help us in assisting you by providing us with a concise and descriptive elaboration of your issues. Be specific and if possible, provide us with a step-by-step instruction in replicating your problem.

Field_Birthdate - age range not followed in date picker

11 years 6 months ago
  • Alan's Avatar
    Topic Author
  • Alan
  • Offline
  • Fresh Boarder
  • Posts: 83
  • Thank you received: 14
Licenses:
JomSocial Expired Socialize Expired

ISSUE SUMMARY:

Set an age range of 18-100 in the field properties in the "BIRTHDATE" field type. On the front end the user is given options of all years from 1915 to 2115 regardless of settings

STEPS TO REPLICATE:
1: Create a birthdate field type, e.g. Date of birth
2: Set an age range

RESULT

Go to edit profile, you can initially select any date between 1915 and 2115 regardless of settings creating a bad user experience as they then get a generic field error

EXPECTED RESULT

User can only select a date between the parameters set in the back end

BROWSER

11 years 6 months ago
  • Dimas's Avatar
  • Dimas
  • Visitor
  • Thank you received: 0
Licenses:

Hi Alan,

I will report this to our developer.

thank you

11 years 6 months ago
  • Dimas's Avatar
  • Dimas
  • Visitor
  • Thank you received: 0
Licenses:

this is the patch, open this file components/com_community/libraries/fields/date.php add this code after line 161 :

// Flip date in case of invalid range.
         if ( isset( $this->_minRange['value'] ) && isset( $this->_maxRange['value'] ) ) {
             if ( ((int) $this->_minRange['year'] ) > ((int) $this->_maxRange['year'] ) ) {
                 $temp = $this->_minRange;
                 $this->_minRange = $this->_maxRange;
                 $this->_maxRange = $temp;
             }
         }
 
         // Set minimum range.
         if ( isset( $this->_minRange['value'] ) ) {
             $value = explode('-', $this->_minRange['value']);
             $html .= "\t\tmin: [" . ((int) $value[0] ) . "," . ((int) $value[1] - 1 ) . "," . ((int) $value[2] ) . "]," . PHP_EOL;
         }
 
         // Set maximum range.
         if ( isset( $this->_maxRange['value'] ) ) {
             $value = explode('-', $this->_maxRange['value']);
             $html .= "\t\tmax: [" . ((int) $value[0] ) . "," . ((int) $value[1] - 1 ) . "," . ((int) $value[2] ) . "]," . PHP_EOL;
         }

and remove this code :
if (isset($initData)) {
            // $html .= '<script>' . $initData . '</script>';
        }

Moderators: Piotr Garasiński
Powered by Kunena Forum

Join 180,000 websites creating Amazing communities

JomSocial is the most complete, easy-to-use addon that turns Joomla CMS into a
full -fledged, social networking site

TRY NOW BUY NOW