[jQuery] Re: submit() question

2009-04-07 Thread debussy007


I understood that in my submit callback funtion, i call a asynchronous
function of google where I set the post values once I have a response. But I
didn't wait for the google function to terminate.

This issue is solved,

Thank you.



debussy007 wrote:
 
 I need something like that, but it is not ajax.
 In the submit callback I need to add additional post parameters.
 
 Concretely, a user may specify a country and a town in my form.
 in the submit callback, I will make a request to Goole Maps API to have
 the longitude and lattitude.
 If google cannot find it, I'll warn the user and return false.
 If google finds the coordinates, I'll add them in the form, but this last
 point, I don't know how to do.
 
 $('#myForm').submit(function() {
 [...]
 var geocoder = new GClientGeocoder();
 geocoder.getLatLng(address,
   function(point) {
   if (!point) {
   alert('La ville de départ n\'a pas été trouvée');
   return false;
   }
   else {
   /*
   set additional params, it does not work
   longDepIntId and lattDepIntId are hidden input
   */
   $('#longDepIntId').val(point.lng());
   $('#lattDepIntId').val(point.lat());
   }
   } // end func
 ); // end geocoder
 [...]
 });
 
 
 
 
 Sean McKenna wrote:
 
 
 I'm not sure I understand what you are trying to do, but if the
 requirement is to pass the values to the server, you can include them
 in the data parameter of the ajax routine.
 
  data: $(this).serialize() + add_item=1,
 
 
 On Apr 5, 3:10 pm, debussy007 debussy...@gmail.com wrote:
 What do you mean by wrap 'submit()' that is built in 'form object' ?
 Sorry I didn't understand )



 kcis...@hotmail.com wrote:

  I guess you'd better wrap 'submit()' that is built in 'form object'.
  before the submit() is called,  you should set the values.

  On 4월5일, 오후1시48분, debussy007 debussy...@gmail.com wrote:
  Hi,

  In my submit() callback function, I want to set two new values in
 some
  hidden input fields right before the post data is submitted, based on
 the
  values the user inputs in some input fields.
  However it seems already too late, the server will never have those
  values
  unfortunately.

  So I wonder if there is any way to achieve this.

  Thank you for any kind help.
  --
  View this message in
 
 context:http://www.nabble.com/submit%28%29-question-tp22896425s27240p22896425...
  Sent from the jQuery General Discussion mailing list archive at
  Nabble.com.

 --
 View this message in
 context:http://www.nabble.com/submit%28%29-question-tp22896425s27240p22899380...
 Sent from the jQuery General Discussion mailing list archive at
 Nabble.com.
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/submit%28%29-question-tp22896425s27240p22922674.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



[jQuery] Re: submit() question

2009-04-06 Thread Sean McKenna

I'm not sure I understand what you are trying to do, but if the
requirement is to pass the values to the server, you can include them
in the data parameter of the ajax routine.

 data: $(this).serialize() + add_item=1,


On Apr 5, 3:10 pm, debussy007 debussy...@gmail.com wrote:
 What do you mean by wrap 'submit()' that is built in 'form object' ?
 Sorry I didn't understand )



 kcis...@hotmail.com wrote:

  I guess you'd better wrap 'submit()' that is built in 'form object'.
  before the submit() is called,  you should set the values.

  On 4월5일, 오후1시48분, debussy007 debussy...@gmail.com wrote:
  Hi,

  In my submit() callback function, I want to set two new values in some
  hidden input fields right before the post data is submitted, based on the
  values the user inputs in some input fields.
  However it seems already too late, the server will never have those
  values
  unfortunately.

  So I wonder if there is any way to achieve this.

  Thank you for any kind help.
  --
  View this message in
  context:http://www.nabble.com/submit%28%29-question-tp22896425s27240p22896425...
  Sent from the jQuery General Discussion mailing list archive at
  Nabble.com.

 --
 View this message in 
 context:http://www.nabble.com/submit%28%29-question-tp22896425s27240p22899380...
 Sent from the jQuery General Discussion mailing list archive at Nabble.com.


[jQuery] Re: submit() question

2009-04-06 Thread ryan.j

wouldn't the callback happen after the submit() function had executed,
so you'd be putting the new values in after the submit?

On Apr 5, 11:10 pm, debussy007 debussy...@gmail.com wrote:
 What do you mean by wrap 'submit()' that is built in 'form object' ?
 Sorry I didn't understand )



 kcis...@hotmail.com wrote:

  I guess you'd better wrap 'submit()' that is built in 'form object'.
  before the submit() is called,  you should set the values.

  On 4월5일, 오후1시48분, debussy007 debussy...@gmail.com wrote:
  Hi,

  In my submit() callback function, I want to set two new values in some
  hidden input fields right before the post data is submitted, based on the
  values the user inputs in some input fields.
  However it seems already too late, the server will never have those
  values
  unfortunately.

  So I wonder if there is any way to achieve this.

  Thank you for any kind help.
  --
  View this message in
  context:http://www.nabble.com/submit%28%29-question-tp22896425s27240p22896425...
  Sent from the jQuery General Discussion mailing list archive at
  Nabble.com.

 --
 View this message in 
 context:http://www.nabble.com/submit%28%29-question-tp22896425s27240p22899380...
 Sent from the jQuery General Discussion mailing list archive at Nabble.com.


[jQuery] Re: submit() question

2009-04-06 Thread debussy007


I need something like that, but it is not ajax.
In the submit callback I need to add additional post parameters.

Concretely, a user may specify a country and a town in my form.
in the submit callback, I will make a request to Goole Maps API to have the
longitude and lattitude.
If google cannot find it, I'll warn the user and return false.
If google finds the coordinates, I'll add them in the form, but this last
point, I don't know how to do.

$('#myForm').submit(function() {
[...]
var geocoder = new GClientGeocoder();
geocoder.getLatLng(address,
function(point) {
if (!point) {
alert('La ville de départ n\'a pas été trouvée');
return false;
}
else {
/*
set additional params, it does not work
longDepIntId and lattDepIntId are hidden input
*/
$('#longDepIntId').val(point.lng());
$('#lattDepIntId').val(point.lat());
}
} // end func
); // end geocoder
[...]
});




Sean McKenna wrote:
 
 
 I'm not sure I understand what you are trying to do, but if the
 requirement is to pass the values to the server, you can include them
 in the data parameter of the ajax routine.
 
  data: $(this).serialize() + add_item=1,
 
 
 On Apr 5, 3:10 pm, debussy007 debussy...@gmail.com wrote:
 What do you mean by wrap 'submit()' that is built in 'form object' ?
 Sorry I didn't understand )



 kcis...@hotmail.com wrote:

  I guess you'd better wrap 'submit()' that is built in 'form object'.
  before the submit() is called,  you should set the values.

  On 4월5일, 오후1시48분, debussy007 debussy...@gmail.com wrote:
  Hi,

  In my submit() callback function, I want to set two new values in some
  hidden input fields right before the post data is submitted, based on
 the
  values the user inputs in some input fields.
  However it seems already too late, the server will never have those
  values
  unfortunately.

  So I wonder if there is any way to achieve this.

  Thank you for any kind help.
  --
  View this message in
 
 context:http://www.nabble.com/submit%28%29-question-tp22896425s27240p22896425...
  Sent from the jQuery General Discussion mailing list archive at
  Nabble.com.

 --
 View this message in
 context:http://www.nabble.com/submit%28%29-question-tp22896425s27240p22899380...
 Sent from the jQuery General Discussion mailing list archive at
 Nabble.com.
 
 

-- 
View this message in context: 
http://www.nabble.com/submit%28%29-question-tp22896425s27240p22917308.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



[jQuery] Re: submit() question

2009-04-05 Thread kci

I guess you'd better wrap 'submit()' that is built in 'form object'.
before the submit() is called,  you should set the values.



On 4월5일, 오후1시48분, debussy007 debussy...@gmail.com wrote:
 Hi,

 In my submit() callback function, I want to set two new values in some
 hidden input fields right before the post data is submitted, based on the
 values the user inputs in some input fields.
 However it seems already too late, the server will never have those values
 unfortunately.

 So I wonder if there is any way to achieve this.

 Thank you for any kind help.
 --
 View this message in 
 context:http://www.nabble.com/submit%28%29-question-tp22896425s27240p22896425...
 Sent from the jQuery General Discussion mailing list archive at Nabble.com.


[jQuery] Re: submit() question

2009-04-05 Thread debussy007


What do you mean by wrap 'submit()' that is built in 'form object' ?
Sorry I didn't understand )



kcis...@hotmail.com wrote:
 
 
 I guess you'd better wrap 'submit()' that is built in 'form object'.
 before the submit() is called,  you should set the values.
 
 
 
 On 4월5일, 오후1시48분, debussy007 debussy...@gmail.com wrote:
 Hi,

 In my submit() callback function, I want to set two new values in some
 hidden input fields right before the post data is submitted, based on the
 values the user inputs in some input fields.
 However it seems already too late, the server will never have those
 values
 unfortunately.

 So I wonder if there is any way to achieve this.

 Thank you for any kind help.
 --
 View this message in
 context:http://www.nabble.com/submit%28%29-question-tp22896425s27240p22896425...
 Sent from the jQuery General Discussion mailing list archive at
 Nabble.com.
 
 

-- 
View this message in context: 
http://www.nabble.com/submit%28%29-question-tp22896425s27240p22899380.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.