Jump to content

how to call the controller from the view In MVC model Framework


prasanna83

Recommended Posts

How to access or call the controller from the view page on change action of a drop down here my sample view page

<?php

//TO DO

require_once __SITE_PATH . '/libs/form_handler.php';

// require_once __SITE_PATH . '/app/views/settings/redirect.php';

?>

<?php

if (!empty($pagefields))

{

$combotype = $pagefields['combotype'];

}else

{

$combotype = '';

}

$form = new lscform();

$form->openForm(array('action' => '', 'name' => 'addSettingsForm'));

$form->addInline('<br />');

$form->addLabel('Combo Type', array('for' => 'Combo Type ', 'style' => 'float: left; width: 10em; margin-right: 1em;'));

$form->openSelect(array('name' => 'combotype', 'id' => 'combotype', 'onchange' => 'getIPL(this.value)'));

$form->addOption('Select the value',array('value'=>0));

foreach ($data as $value)

{

if ($value['id']==$combotype)

{

$form->addOption($value['type'],array('value'=>$value['id'] ,'selected'=>'selected' ));

}else

{

$form->addOption($value['type'],array('value'=>$value['id'] ));

}

}

$form->closeSelect();

$form->addInline('<br/>');

$form->closeForm();

//echo '<div style="border: 1px solid darkgrey; text-align: center; width:430px;">';

echo $form;

//echo '</div>';

?>

<script src ="<?php echo __SITE_PATH;?>/styles/js/jquery.min.js"></script>

<script type="text/javascript">

function getIPL(id)

{

var url = location.href;

var pathname = location.pathname;

var index1 = url.indexOf(pathname);

var index2 = url.indexOf("/", index1 + 1);

var baseLocalUrl = url.substr(0, index2);

baseLocalUrl = baseLocalUrl + "/";

 

var url = "settings/Display";

// window.location.href=url ;

if (window.XMLHttpRequest)

{

xmlhttp=new XMLHttpRequest();

}

else

{

xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

}

xmlhttp.onreadystatechange=function()

{

if (xmlhttp.readyState==4 && xmlhttp.status==200)

{

document.getElementById("combotype").innerHTML=xmlhttp.responseText;

}

}

queryString = "?id="+id;

xmlhttp.open("GET", url+queryString , false);

xmlhttp.send(null);

}

</script>

<?php

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...