Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
my java code is not working please help

What I have tried:

JavaScript
<form method='POST' action='' name='pay'>
		
		<label> Payment method:</label>
		
		 <select name='paymth' id='paymth' onChange='changetextbox();' >
      <option value='Deposit In Bank'>Deposit In Bank</option>
      <option value='Online'>Online Transfer (Net Banking/RTGS/NEFT/Mobile Banking)</option>
      <option value='Cheque Deposit In Bank'>Cheque Deposit In Bank</option>
    </select>
	
	<label >Name of Depositor*:</label>
	<input id='bd' type='text' name='depositor'>
	<label >Bank Name:</label>
	<input  type='text' name='bank'  required>
	<label >Date*: (DD-MM-YYYY)</label>
	<input  type='text' name='date' required>
	<label>Payment Proof*:(Scan copy, Deposit Receipt, Photo, Screenshot, Transaction Print. )</label>
	<br>
	<input type='file' name='proof' required>
	<input type='submit' name='payment' value='Submit'>
		</form>
		<script type="text/javascript">
function changetextbox()
{
    if (document.getElementById("paymth").value === "Online") {
        document.getElementById("bd").disable='true';
    } 
}
</script>
Posted
Updated 7-Mar-18 10:00am
v5
Comments
A_Griffin 7-Mar-18 11:17am    
You haven't posted enough information for anyone to help, or even asked a question. But, you have 4 (that I can see) elements on your page all with the same ID, so that won't help...
ZurdoDev 7-Mar-18 11:31am    
How would you like us to help?
Member 11544111 7-Mar-18 11:33am    
javascript code is not working
Patrice T 7-Mar-18 11:36am    
this is not informative.
Describe the problem.
ZurdoDev 7-Mar-18 11:38am    
OK. What would you like us to do? Do you think we know what it should do? Do you think we know what isn't working? Is there an error? You need to help us help you.

It has been generally understood in most well-informed circles that when a program is "not working", it is usually because it has the day off.

If the problem persists, it may well be on holiday.

 
Share this answer
 
Based on what posted here, I assumed the "not working" referring to when the Payment method changed to Online transfer... the Name of depositer textbox didn't get disabled?

Look like there is a typo in the script, it should be disabled instead of disable

JavaScript
document.getElementById("bd").disabled='true';


Here is a working example based on what posted here: CP_Dropdown_Change - JSFiddle[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900