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

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -