Record selector in independent page.
Posted: 2016-05-30 07:57
Version 5.50
Hi,
I would like, after login, to redirect to a page when you have to choose a value from a dropdown, and save this value on SESSION.
Redirection works, but I can't get dropdown working. I based on Udemy class of lookup search filters for HTML. I created a myfile.php in project root.
Then:
But dropdown keep spining without showing me the record in database.
There are any tutorial on custom pages out there? I think this is a basic need/feature (all projects needs pages don't connected directly to a database but working with its data to do some proccess) but it's difficult for me to find this information.
It's easy what I want to do. I just want to show a dropdown with a list of companies, and once a company is selected and press a button, saves company ID on a session var (tu use in all other apps) and redirects to home.
Hi,
I would like, after login, to redirect to a page when you have to choose a value from a dropdown, and save this value on SESSION.
Redirection works, but I can't get dropdown working. I based on Udemy class of lookup search filters for HTML. I created a myfile.php in project root.
Then:
Code: Select all
<?php
$currDir = dirname(__FILE__);
include("$currDir/defaultLang.php");
include("$currDir/language.php");
include("$currDir/lib.php");
include_once("$currDir/header.php");
/* grant access to all logged users */
$mi = getMemberInfo();
if(!$mi['username'] || $mi['username'] == 'guest'){
echo "Access denied";
exit;
}
?>
<div style="margin-top: 20px;">
<label>Choose Company</label>
<div style="max-width: 550px;"><span id="EmpresaDropDown"></span></div>
</div>
<script>
$j(function(){
/* display a drop down of categories that populates its contents from ajax_combo.php */
$j('#EmpresaDropDown').select2({
ajax: {
url: 'ajax_combo.php',
dataType: 'json',
cache: true,
data: function(term, page){ return { s: term, p: page, t: 'empresa', f: 'id' }; },
results: function(resp, page){ return resp; }
},
width: 550
}).on('change', function(e){
//$j('#CategoryID').val(e.added.text);
});
})
</script>
<?php
include_once("$currDir/footer.php");
?>
There are any tutorial on custom pages out there? I think this is a basic need/feature (all projects needs pages don't connected directly to a database but working with its data to do some proccess) but it's difficult for me to find this information.
It's easy what I want to do. I just want to show a dropdown with a list of companies, and once a company is selected and press a button, saves company ID on a session var (tu use in all other apps) and redirects to home.