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
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 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'); 

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

  • #4
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    3,763
    Thanks
    23
    Thanked 548 Times in 547 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.


  •  

    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
    •