Ok, I'll put this here for anyone else searching for the same
subjects. If anyone feels I could or should have figured this out by
reading the proper documents, I would like to hear that too, with
specifics. Instead I didn't hook up a working version until I dug
through discussions on this group/list and pieced together several
bits from several different threads.
Here is a working solution to getting a text field to be transmitted
to a controller every time a keypress is made, using Pylons 9.6.1.
Skip the h.observe_field webhelper and do the following instead. (If
anyone can tell me how to use observe_field properly, that would be
great too... would like to experiment with the frequency and so
forth).
${h.start_form(
url=h.url_for(
controller="some_controller"
action="some_action"))}
some prompt text here
<input type="text" name="searchtext" onkeypress="\
${h.remote_function(
update="results"
url=h.url_for(
controller="foo",
action="bar"),
with_='{searchtext:value}' ) }" />
${h.submit("save", name="commit")}
${h.end_form()}
<div id="results">
lalala
</div>
To test this, set up a simple controller and method that just returns
request.params.mixed(), or returns request.params['searchtext']. You
see an exact copy of what you type in the text box show up in the div
below.
Seems like this is a basic or common enough thing to want to do, that
it should be more prominently documented somewhere in the Pylons
newbie (or maybe low-intermediate just starting to get somewhere?)
info.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---