Hello,
This is a JavaScript/PHP question so I will go ahead and post it here.
I would like to know if it is possible to access (in a PHP class) a value/variable that has been returned by a JavaScript function. The function is in external .js class.
Here what I am trying to do:
(1) create a variable called 'userInfo' to store information we want to display
(2) if user selects 'Duplicate TR' for example the variable 'userInfo' contains text 'Fill in TR num ….'
(3) return the variable
(4) in the php code AnalyseFaultView I'm trying to echo the return value but it doesn't seem to work
If anybody could help me out it would be much appreciated.
Rgds,
Gary888
Utitlity.js
******************************************************
******************************************************
function AnalyseFaultCheck(){
var reasonDropdownList=document.getElementById("whatisthereasonforfaultslippage");
var statusDropdownList=document.getElementById("status");
var updateButton=document.getElementById("update");
var proposedActions=document.getElementById("proposedactions");
var userInfo='';
if("Duplicate TR"==reasonDropdownList.options[reasonDropdownList.selectedIndex].value && proposedActions.value=='')){
userInfo="Fill in TR num of original TR";
return userInfo;
statusDropdownList.disabled=true;
updateButton.disabled=true;
}
if("Duplicate TR"==reasonDropdownList.options[reasonDropdownList.selectedIndex].value && proposedActions.value!='')){
userInfo="Fill in TR num of original TR";
return userInfo;
statusDropdownList.disabled=false;
updateButton.disabled=false;
}
******************************************************
******************************************************
AnalyseFaultView.php
******************************************************
******************************************************
<!-- #4 Proposed action: -->
<tr>
<td class="admin"><b><font color='black' face='arial' size='2'><?php echo $dataRow->GetDataRowItemCaptionByName("Proposed_Actions");?></font></b></td>
<td class="admin"><font color='black' face='arial' size='2'> <?php echo $dataRow->GetDataRowItemByName("Proposed_Actions");?></font>
<br>
<?php echo '<script>AnalyseFaultCheck();</script>'; ?>
<textarea id="proposedactions" name="proposedactions" onkeyup="AnalyseFaultCheck()" rows="10"
cols="30" style="width:100%"></textarea></td>
</tr>
******************************************************
******************************************************