Snippets

Create an account or login to be able to add, comment and rate snippets.

Navigation

How to perform an action when input_date_tag changes.

What is worth noting in the snippet below is the usage of the 'onchange'=> remote_function( ... you can use the remote_function in many places to call other functions ... like in the "update", "complete" etc...

<div id="js_updating">Stand by..</div>
<?php echo form_tag('/module/action', 'method=get class=simpleForm') ?>
Please select the day:
<?php
echo input_date_tag('day', 'now', array('rich' => true, 'readonly'=>true, 'onchange'=> remote_function( array(
      'update'   => 'Area To Update (DIV TAG)',
      'url'      => 'MODULE/ACTION',
      'loading'  => "Element.show('js_updating')",
      'complete' => "Element.hide('js_updating')"
  ))));
 
?>
 
</form>
by Fuad Arafa on 2006-08-23, tagged ajax  forms  javascript 

Comments on this snippet

gravatar icon
#1 Martin on 2006-09-21 at 02:49

In case you are wondering how to pass the date value to the called action:

gravatar icon
#2 Martin on 2006-09-21 at 02:50

(...continued (snippeet seems to be buggy...))

Add the option 'with' => "'day='+value" to the remote_function() options.

You need to create an account or log in to post a comment or rate this snippet.