[Seaside] Re: get value within a textinput with jQuery
Sabine Knöfel
sabine.knoefel at gmail.com
Tue Jul 16 13:40:10 UTC 2013
Hi Johan,
I want to get the value of the textinput within the callback of the textinput.
Explanation:
With Google Places autocompleter
(http://webtrouble.blogspot.de/2013/01/google-address-autocomplete.html),
the user selected a place which is displayed in the textInput.
This works fine.
Now, I want to save this place in my model.
renderStartPlaceOn: html
"this script sets the selected place in the field with the id 'mid'"
html html: ('<script type="text/javascript">
jQuery(function() \{
var input = document.getElementById(''{1}'');
var autocomplete = new google.maps.places.Autocomplete(input);
google.maps.event.addListener(autocomplete, ''place_changed'', function() \{
var place = autocomplete.getPlace();
var adr = place.formatted_address;
jQuery(''#{1}'').val(adr);
});
});
</script>' format: {mid}).
"this is the text input with id 'mid' "
html textInput
id: mid;
size: self defaultEntryFieldWidth;
value: self startPlace;
callback: [ :value | |theStartPlaceString|
"**********This does not work, how can I get the value from the mid
field which was set by the script above?********"
theStartPlaceString:= html jQuery ajax
callback: [:v | v inspect. ]
value: (html jQuery id: #searchTextField) value.
self startPlace: theStartPlaceString ];
onChange:
(html scriptaculous updater
id: mid;
triggerForm: fid;
callback: [ :r |
r render: self startPlace ]);
onBlur: html jQuery ajax serializeThis.
Greetings
Sabine
On Tue, Jul 16, 2013 at 3:15 PM, Johan Brichau-2 [via Smalltalk]
<ml-node+s1294792n4698938h73 at n4.nabble.com> wrote:
> Hi Sabine,
>
> I guess you want the value server-side?
> You thus need to serialize that value:
>
> html jQuery ajax
> callback: [:v | ... ]
> value: (html jQuery id: #searchTextField) value
>
> Johan
>
> Sent from my iPad
>
> On 16 Jul 2013, at 14:01, Sabine Knöfel <[hidden email]> wrote:
>
>> Hi,
>>
>> I want to get the value which was entered into a textinput by doing
>>
>> (html jQuery id: #searchTextField) value.
>>
>> but I get
>> a JQueryInstance
>> (jQuery("#searchTextField").val())
>>
>> How can I get the value (String) of the text field?
>>
>> Greetings
>> Sabine
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://forum.world.st/get-value-within-a-textinput-with-jQuery-tp4698913.html
>> Sent from the Seaside General mailing list archive at Nabble.com.
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://forum.world.st/get-value-within-a-textinput-with-jQuery-tp4698913p4698938.html
> To unsubscribe from get value within a textinput with jQuery, click here.
> NAML
--
View this message in context: http://forum.world.st/get-value-within-a-textinput-with-jQuery-tp4698913p4698942.html
Sent from the Seaside General mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20130716/6496ddcf/attachment.htm
More information about the seaside
mailing list