Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Nov 2013
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Image call script by using onclick

    I have a form where you have to inset a date.Im using a script that can auto fill the form with a choosen date.

    The form looks like this:

    Code:
    <input type="text" value="<?=date('Ymd');?>" id="from" id="<?php echo $_REQUEST["from"]; ?>" name="displaydate">
    The:
    PHP Code:
    <?=date('Ymd');?>
    just show the date of today. If you want to use anyother date you can click on the form and a "drop-down" calendar is showed. Its the code:
    PHP Code:
    <?php echo $_REQUEST["from"]; ?>
    that call the script. The script looks like:

    PHP Code:
    <script>
        $(function() {
            var 
    dates = $( "#from, #to" ).datepicker({
                
    changeMonthtrue,
                
    numberOfMonths2,
                
    dateFormat'yy-mm-dd',
                
    onSelect: function( selectedDate ) {
                    var 
    option this.id == "from" "minDate" "maxDate",
                        
    instance = $( this ).data"datepicker" ),
                        
    date = $.datepicker.parseDate(
                            
    instance.settings.dateFormat ||
                            $.
    datepicker._defaults.dateFormat,
                            
    selectedDateinstance.settings );
                    
    dates.notthis ).datepicker"option"optiondate );
                }
            });
        });
        
    </script> 
    Now what I need help to, is that I would like to place a small calendar image beside the form. When you click the small image the calendar also "drop-down" just as when you click on the form. I have tried with the code:
    Code:
    <img src='images/calendar.png' onclick="from" style='cursor: pointer; vertical-align: middle;' />
    but that dont help. Any suggestions?

  2. #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    17,027
    Thanks
    4
    Thanked 2,668 Times in 2,637 Posts
    This doesn't appear to have anything to do with PHP. Moving to Javascript forum.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  3. #3
    New to the CF scene
    Join Date
    Nov 2013
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Any suggestions here?

  4. #4
    Master Coder sunfighter's Avatar
    Join Date
    Jan 2011
    Location
    Washington
    Posts
    6,076
    Thanks
    30
    Thanked 834 Times in 832 Posts
    As long as your using Jquery already, why not just use a plug-in?
    Check this one out: http://www.kelvinluck.com/assets/jqu...icker/v2/demo/
    Evolution - The non-random survival of random variants.
    Physics is actually atoms trying to understand themselves.


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •