Skip to content

Instantly share code, notes, and snippets.

@fivestar
Created July 26, 2010 09:28
Show Gist options
  • Save fivestar/490357 to your computer and use it in GitHub Desktop.
Save fivestar/490357 to your computer and use it in GitHub Desktop.
<?php echo $form->renderFormTag(url_for('foo/bar'), array('id' => 'foo_form')) ?>
<?php echo $form->renderHiddenFields() ?>
<!--
下の奴がレンダリングされるとする
<input type="hidden" id="foo_hiddden" name="foo[hidden]" value="wozozo" />
-->
<input type="submit" value="submit" />
</form>
<script>
$('#foo_form').submit(function(event) {
document.getElementById('foo_hidden').value = 'yudoufu';
event.target.submit();
event.preventDefault();
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment