Im pulling my hair out. . . .
Im using an inline call to the web2py ajax function via the controller as
below:
ajax_form.element('#Debts_creditor')['_onkeyup'] =
"ajax('https:.../t2/default/cred_selector', ['creditor'], 'suggestions');"
The goal is for this ajax call to control a div that I am inserting in a
dynamically created iframe div, per below.
Ive been at this for two days and cannot for the life of me figure out what
Im doing wrong. Any help would be much appreciated.
<script>
$('.iframe_input').click(function(){
var element = $(this).attr('name');
$('#iframe_target').html('<iframe
src="https://104.131.18.58/t2/default/ajax_form_creator?' +
'all='+ element +
'" frameborder="0" width="580" height="300" scrolling="yes"
id="myFrame" onload="row_adder()"></iframe>');
});
function row_adder() {
var iframe = document.getElementById('myFrame'),
iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
$(iframeDoc).find('#Debts_creditor__row').after('<tr
id="suggestions"><td colspan=2>here</td></tr>');
}
</script>
def cred_selector():
if not request.vars.creditor:
return ""
else:
click_string = "jQuery('#Debts_creditor').val('%s');
jQuery('#Debts_street_1').val('%s'); \
jQuery('#Debts_street_2').val('%s');
jQuery('#Debts_zip_code').val('%s')"
pattern = request.vars.creditor + '%'
selected = [[row.creditor, row.street_1, row.street_2,
row.zip_code] for row in
db(db.preferred_creditor.creditor.like(pattern)).select()]
return ''.join([DIV(k[0], _onclick=click_string %(k[0], k[1], k[2],
k[3]),
_onmouseover="this.style.backgroundColor='grey'",
_onmouseout="this.style.backgroundColor='white'").xml() for k in selected])
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.