RsFormPro get a form field selected value and pass to another field
Project details
Dear Sirs
(1) Name : sch_id ; Additional Attributes : onclick=”myFunction()”
Note : Items : is generate by php as below code
//<code>
// Prepare the empty array
$items = array();
// Prepare the database connection
$db = JFactory::getDbo();
// Keep this if you’d like a “Please select” option, otherwise comment or remove it
$items[] = “|Please Select[c]”;
// Run the SQL query and store it in $results
$db->setQuery(“SELECT id, name_en FROM #__ad_scheduler ORDER BY id ASC”); …….
(2) Form Fields : HTML Layout , I add a Ajax Example AND it works
<script>
var xmlhttp;
function loadXMLDoc(url,cfunc)
{ if () {
xmlhttp=new XMLHttpRequest();
} else {
xmlhttp=new ActiveXObject(“”);
}
xmlhttp.onreadystatechange=cfunc;
(“GET”,url,true);
();
}
function myFunction()
{ loadXMLDoc(“/modules/aRsFormPro/”,function()
{ if (xmlhttp.readyState==4 && xmlhttp.status==200)
{ (“myDiv”).innerHTML=;
}
});
}
</script>
<div id=”myDiv”><h2>Display AJAX Content here</h2></div>
<button type=”button” onclick=”myFunction()”>DIsplay Text</button>
MY QUESTION IS
HOW can I get the before submission
something likes $asch_id = [‘form’][‘sch_id’].value;
that I can use $asch_id at another field Name : item_id
//<code>
// Prepare the empty array
$asch_id = 6; <=== the 6 is manually input, I need to get the selected item from Name = sch_id
$items = array();
// Prepare the database connection
$db = JFactory::getDbo();
// Keep this if you’d like a “Please select” option, otherwise comment or remove it
$items[] = “|Please Select[c]”;
// Run the SQL query and store it in $results
$db->setQuery(“SELECT id, name_en FROM #__ad_item WHERE sch_id = $asch_id ORDER BY name_en ASC”);
$results = $db->loadObjectList();
Awarded to:

Dipendra B.
(4.8)
Awarded to:

Dipendra B.
(4.8)
Project details
(1) Name : sch_id ; Additional Attributes : onclick=”myFunction()”
Note : Items : is generate by php as below code
//<code>
// Prepare the empty array
$items = array();
// Prepare the database connection
$db = JFactory::getDbo();
// Keep this if you’d like a “Please select” option, otherwise comment or remove it
$items[] = “|Please Select[c]”;
// Run the SQL query and store it in $results
$db->setQuery(“SELECT id, name_en FROM #__ad_scheduler ORDER BY id ASC”); …….
(2) Form Fields : HTML Layout , I add a Ajax Example AND it works
<script>
var xmlhttp;
function loadXMLDoc(url,cfunc)
{ if () {
xmlhttp=new XMLHttpRequest();
} else {
xmlhttp=new ActiveXObject(“”);
}
xmlhttp.onreadystatechange=cfunc;
(“GET”,url,true);
();
}
function myFunction()
{ loadXMLDoc(“/modules/aRsFormPro/”,function()
{ if (xmlhttp.readyState==4 && xmlhttp.status==200)
{ (“myDiv”).innerHTML=;
}
});
}
</script>
<div id=”myDiv”><h2>Display AJAX Content here</h2></div>
<button type=”button” onclick=”myFunction()”>DIsplay Text</button>
MY QUESTION IS
HOW can I get the before submission
something likes $asch_id = [‘form’][‘sch_id’].value;
that I can use $asch_id at another field Name : item_id
//<code>
// Prepare the empty array
$asch_id = 6; <=== the 6 is manually input, I need to get the selected item from Name = sch_id
$items = array();
// Prepare the database connection
$db = JFactory::getDbo();
// Keep this if you’d like a “Please select” option, otherwise comment or remove it
$items[] = “|Please Select[c]”;
// Run the SQL query and store it in $results
$db->setQuery(“SELECT id, name_en FROM #__ad_item WHERE sch_id = $asch_id ORDER BY name_en ASC”);
$results = $db->loadObjectList();