Created
July 18, 2013 12:58
-
-
Save guipdutra/6029088 to your computer and use it in GitHub Desktop.
halp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("#pledge_main_pledge_id").on("change", function (event, main_pledge) { | |
if (main_pledge) { | |
var url = "<%= auto_fill_custom_fields_pledges_path %>", | |
params = {main_pledge_id: $(this).val(), edit_path: true}; | |
$(this).parents("form").blockContent(); | |
$.post(url, params, function(data) { | |
if(data.success) { | |
var form = $("form"); | |
// Retiro o formulário atual da tela | |
form.children().remove(); | |
// Colo o novo formulário com os campos preenchidos | |
form.append($(data.partial).children()); | |
// Chama JS global de dependência de campos customizados | |
callCustomDataDependencies(); | |
init(); | |
} | |
}); | |
} else { | |
$("[id^=pledge_]").val(''); | |
// Chama JS global de dependência de campos customizados | |
callCustomDataDependencies(); | |
elCapability.data('modal-url', '<%= modal_capabilities_path %>'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment