CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Alpha and Beta Release Testing »
  • 3.1 Release Testing »
  • Date Field Providing two Input tags for Profiles in HTML Snippet
Pages: [1]

Author Topic: Date Field Providing two Input tags for Profiles in HTML Snippet  (Read 2164 times)

jubex

  • Guest
Date Field Providing two Input tags for Profiles in HTML Snippet
December 18, 2009, 12:03:31 pm
After I upgraded to 3.1beta2, a profile that collects the date of birth for a consituent had two <input> tags in one <td> tag. The first <input> launches the date picker js, and the second is automatically populated with the same date selected.

I modified the HTML to hide the second <input> tag. Here's the code that came from the HTML Snippet:

Code: [Select]
<tr id="editrow-birth_date"><td class="label"><label for="birth_date">Birth Date</label></td><td class="edit-value"><input formattype="birth" startoffset="100" endoffset="0" format="mm/dd/yy" readonly="1" name="birth_date" type="text" id="birth_date" class="dateplugin" /><input type="text" name="birth_date_hidden" id="birth_date_hidden" class="hiddenElement"/>&nbsp;&nbsp;&nbsp;&nbsp;(<a href="javascript:clearDateTime( 'birth_date' );">clear</a>)&nbsp;<script type="text/javascript">var element_date   = "#birth_date";var element_time  = "#birth_date_time";var time_format   = cj( element_time ).attr('timeFormat');
            cj(element_time).timeEntry({ show24Hours : time_format });
        var date_format = cj( element_date ).attr('format');var startYear   = cj( element_date ).attr('startOffset');var endYear     = cj( element_date ).attr('endOffset');var alt_field   = 'input#birth_date_hidden';
    cj(element_date).datepicker({
                                    closeAtTop        : true,
                                    dateFormat        : date_format,
                                    changeMonth       : true,
                                    changeYear        : true,
                                    altField          : alt_field,
                                    altFormat         : 'mm/dd/yy',
                                    yearRange         : '-'+startYear+':+'+endYear
                                });
    
    cj(element_date).click( function( ) {
        hideYear( this );
    });  
    cj('.ui-datepicker-trigger').click( function( ) {
        hideYear( cj(this).prev() );
    });  
    
    function hideYear( element ) {
        var format = cj( element ).attr('format');
        if ( format == 'dd-mm' || format == 'mm/dd' ) {
            cj(".ui-datepicker-year").css( 'display', 'none' );
        }
    }
    
    function clearDateTime( element ) {
        cj('input#' + element + ',input#' + element + '_time').val('');
    }
    </script></td></tr>

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Date Field Providing two Input tags for Profiles in HTML Snippet
December 18, 2009, 12:11:27 pm
I think HTML code is correct. Are you having any issues?

Kurund
Found this reply helpful? Support CiviCRM

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Alpha and Beta Release Testing »
  • 3.1 Release Testing »
  • Date Field Providing two Input tags for Profiles in HTML Snippet

This forum was archived on 2017-11-26.