Friday, May 20, 2011

jquery onchange select go to another webpage

Hi everyone im kinda new to cake. I have a silly problem.

I have a database composed of states. What i'm trying to do is when
you click the select box it goes to the detail page of the state you
have chosen.

I cant figure out how to do a jquery onchange jump to the state id.

I have always done this threw Dreamweaver and have never had to do
this in cake.

//controller

function xindex() {

$this->set('states',$this->State->find('list'));

}

//view

<script type="text/javascript">

function jumpMenu(div) {

//get value of select menu

var newLocation = $("#"+div).val();

location.href = newLocation;

}

</script>

<div class="examples form">

<?php echo $this->Form->create('state');?>

<fieldset>

<legend>
<?php

echo $this->Form->input('State.state_id');

?>

</fieldset>

<?php echo $this->Form->end('Submit');?>

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate