Massimiliano,

After you replace the public element with the new input you need to
rewire the form so that the new button is properly recognized.  But
you don't want double event handlers, so you need to first fully
"unwire" it.  Ideally you'd put this code in its own function, but the
idea is this:

$(".public").after("<input type="submit" name="action" value="Update"
class="update">").remove();
$('#formPub').unbind('submit').find(':submit,input:image').unbind('click');
$('#formPub').ajaxForm({
target: '#response',
beforeSubmit: function() { /* whatever */ },
success: function(){  $('#response').fadeIn('slow'); }
});

Mike

On 7/2/07, Massimiliano Marini <[EMAIL PROTECTED]> wrote:

Hi all,

I'm not sure if subject is right, but I'm going crazy with this
problem:

after an ajaxCall I return this code:

$(".public").after("<input type="submit" name="action" value="Update"
class="update">").remove();

this code works well, in the form the button (Public) is replaced with
(Update), but when I press the button not "action" value is passed, only
the content of the fields are passed.

This code for the Public event works well, but not works for Update
event when the button is replaced.

$('#formPub').ajaxForm({
  target: '#response',
  beforeSubmit: function() {
   //Some check
  },
  success: function(){
    $('#response').fadeIn('slow');
  }
});

More detail on update event :in Firebug, in the post tab, I can see all
the fields value but not this value: action: Update.

Where I'm in error?

--
Massimiliano Marini - http://www.linuxtime.it/massimilianomarini/
"It's easier to invent the future than to predict it."  -- Alan Kay

Reply via email to