Skip to content

setValues() instead of setValue() #2420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions components/dom_crawler.rst
Original file line number Diff line number Diff line change
Expand Up @@ -278,16 +278,17 @@ To work with multi-dimensional fields::
<input name="multi[dimensional]" />
</form>

You must specify the fully qualified name of the field::
You must specify the values of multi-dimensional fields as arrays itself to
address which fields' values should be changed::
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I liked the old, short description better.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that it sounds better but it doesn't really match the code as you do not real fully qualified names. Any propositions for a better phrasing?


// Set a single field
$form->setValue('multi[0]', 'value');
$form->setValues(array('multi' => array('value')));

// Set multiple fields at once
$form->setValue('multi', array(
$form->setValues(array('multi' => array(
1 => 'value',
'dimensional' => 'an other value'
));
)));

This is great, but it gets better! The ``Form`` object allows you to interact
with your form like a browser, selecting radio values, ticking checkboxes,
Expand Down