Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #22784
| From | hipa <hipa@telenet.be> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | pass to function |
| Date | 2014-01-25 18:07 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <lc0ugb$mqb$3@dont-email.me> (permalink) |
Hi
I have a page with a dropdown list with value's from a db. When one item is selected a table with invoices changes.
I want to do the same if I put a value into a text field, but cannot get it to work. Something like:
<input type="text" onchange="getInvoices();" />. But how can I pass the entered value to the getInvoices() function?
This is the working code:
<select name="client_id" id="client_id" onchange="getInvoices();">
<option value="null" selected="selected"><?php echo $this->lang->line('invoice_all_clients');?></option>
<?php foreach($clientList->result() as $row): ?>
<option value="<?php echo $row->id;?>"><?php echo $row->name;?></option>
<?php endforeach; ?>
</select>
function getInvoices (elm) {
new Ajax.Request(base_url+'invoices/retrieveInvoices/', {postBody: Form.serialize($('filter')), onComplete: function(response) {
if (response.responseText != '') {
invoiceArray = eval('(' + response.responseText + ')');
$('invoiceListings').style.position = "relative";
$('invoiceListings').style.left = "0";
$('invoiceListings').style.visibility = "visible";
drawTable(invoiceArray);
} else {
$('invoiceListings').style.position = "absolute";
$('invoiceListings').style.left = "-5000px";
$('invoiceListings').style.visibility = "hidden";
}
}})
}
Back to comp.lang.javascript | Previous | Next — Next in thread | Find similar | Unroll thread
pass to function hipa <hipa@telenet.be> - 2014-01-25 18:07 +0000
Re: pass to function Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-01-25 19:24 +0100
Re: pass to function hipa <hipa@telenet.be> - 2014-01-26 15:31 +0000
Re: pass to function Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-01-26 17:58 +0100
csiph-web