javascript - Get form value from Sonata Admin -
i value form of sonata admin, in source html have example:
<input type="text" class="span5" maxlength="255" required="required" name="s215268450cfc7[username]" id="s215268450cfc7_username">
s215268450cfc7 uniqid, add fields in form? regenerate after refresh page.
i value form, can't use:
$('#s215268450cfc7_username').val()
because still renames.
you can parse uniqid
<form>
element, or can use:
$('form [id$="_username"]').val()
also, twig template, can access name (depending on whether have access whole form, or username field):
{{ form.children.username.vars.name }}
Comments
Post a Comment