Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,016 members, 7,818,006 topics. Date: Sunday, 05 May 2024 at 03:39 AM

How To Change An Input Field Using Onchange Handler, And Submit - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / How To Change An Input Field Using Onchange Handler, And Submit (955 Views)

Check If Input Is Number Javascript / React Native Check Text Input Is Empty Or Not In Android / What Happen With EFCC Social Media Handler (2) (3) (4)

(1) (Reply)

How To Change An Input Field Using Onchange Handler, And Submit by kentc3: 1:55pm On Dec 01, 2016
Please, i need your help. I am new to jquery and am in need of it to achieve a task. Please help me out. Beow is a snippet of my code and what i intend to achieve below, after the snippet...





<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Untitled 1</title>

<script type="text/javascript" src="jquery.js"></script>

<script type="text/javascript">
$(document).ready(function (e) {
$("#form"wink.on('submit',(function(e) {
e.preventDefault();
//$("#result"wink.empty();
//$('#loading').show();
$.ajax({
url: "show.php", // Url to which the request is send
type: "POST", // Type of request to be send, called as method
data: new FormData(this), // Data sent to server, a set of key/value pairs (i.e. form fields and values)
contentType: false, // The content type used when sending data to the server.
cache: false, // To unable request pages to be cached
processData:false, // To send DOMDocument or non processed data file it is set to false
success: function(data) // A function to be called if request succeeds
{
//$('#loading').hide();
$("#result"wink.html(data);
}
});
}));
});



</script>





</head>

<body>

<div id="table">
<div id="result" style="background-color:red; height:20px; width:200px;"></div>
<form method="post" action="" id="form" enctype="multipart/form-data">
<table style="width: 100%">
<tr>
<td style="height: 25px; width: 88px">Amount</td>
<td style="height: 25px">

<input name="name" style="width: 161px; height: 29px" type="text" id="name" placeholder="Input amount" onchange/><br/>
</td>
</tr>
<tr>
<td style="height: 25px; width: 88px">&nbsp;calculate</td>
<td style="height: 25px">

<input name="Text1" type="text" id="calculate"/>&nbsp;</td>
</tr>
<tr>
<td style="height: 25px; width: 88px">&nbsp;</td>
<td style="height: 25px">

<input name="pwd" type="text" placeholder="Name"/>&nbsp;</td>
</tr>
<tr>
<td style="width: 88px; height: 30px;">&nbsp;</td>
<td style="height: 30px">

<input style="width: 99px; height: 41px" type="submit" value="Register" name="submit" /></td>
</tr>
</table>
</form>
</div>

</body>

</html>




What i intend to achieve is: Once the value in amount field changes, it goes to a .php page, calculate and display the result as a value in another input field called calculate. When the submit button is pressed, it moves the form to show.php, store in database, and output the result...


I have tried different methods, but am finding it difficult displaying the values in an input field. Please i need your help..

Thanks

(1) (Reply)

Angular 2 And 4 / Sub Menu With A Twist / 5$+ Per Hour Programmering Job With Blockchain Technology Knowledge

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 17
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.