In fact I may have answered a bit quick.
Your solution is great, BUT in my case, I have an additional pb : my
js function calls a "call-back" function. I show you :

function js_function(address){
    geocoder.getLocations(address, js_function_call_back); //
"getLocations" is a Google Maps API function

function js_function_call_back(response){
   // many operations on the response
  // many operations on the response
  // etc.
  test=document.getElementById("test");
  test.value=1; // to change the value of my "hidden input" in my
template
  return true;
}

But this doesn't work. Any suggestions?
Thx a lot :)

On 16 fév, 14:18, arbi <arbin...@gmail.com> wrote:
> Thx nivhab, that's great :)
>
> On 15 fév, 20:56, nivhab <yaniv.ha...@gmail.com> wrote:
>
> > If you'd likeJavaScriptto calculate values before you submit the
> > form then do the following:
>
> > 1. Add a "onSubmit" attribute on your "form" tag which calls a JS
> > function like:
> > <form name="theForm" onSubmit="return doBeforeSubmit()">
>
> > 2. In the implementation of that function calculate whatever you need
> > and plant the result into a hidden input field inside your form OR
> > change the value of an existing input field.
>
> > 3. When you're done, your function should return "true" so that the
> > form submits.
>
> > Now the form submits with the value you have calculated.
> > Good luck.
> > Yaniv
>
> > On Feb 15, 6:56 pm,arbi<arbin...@gmail.com> wrote:
>
> > > Hi all,
>
> > > In fact my pb is : I have a <form> that sends a DATA that the user
> > > writes (input), but I would like it to send javascript_function(DATA)
> > > instead. How to do it?
>
> > > This is my input. The DATA is a "departure"
> > > <input type="text" name="departure" value="" id="departure">
>
> > > What shoud I write instead of name or value to return the
> > > javascript_function(departure) instead of departure only? (my js
> > > function calculates the latitude in fact).
>
> > > In general, how to bring back to viewjavascriptresults?
>
> > > Thanks a lot!
> > >Arbi
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to