Skip to content

Commit

Permalink
Issue #1575060 by Spleshka, andypost, serm, mcjim, nod_: Fixed ajax_h…
Browse files Browse the repository at this point in the history
…tml_ids() are broken for forms with file element (encoding=multipart/form-data).
  • Loading branch information
DavidRothstein committed Apr 1, 2013
1 parent 8104ea7 commit 005708c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion includes/common.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3878,7 +3878,16 @@ function drupal_html_id($id) {
// requested id. $_POST['ajax_html_ids'] contains the ids as they were
// returned by this function, potentially with the appended counter, so
// we parse that to reconstruct the $seen_ids array.
foreach ($_POST['ajax_html_ids'] as $seen_id) {
if (is_array($_POST['ajax_html_ids'])) {
$ajax_html_ids = $_POST['ajax_html_ids'];
}
else {
// jquery.form.js may send the server a comma-separated string instead
// of an array (see http://drupal.org/node/1575060), so we need to
// convert it to an array in that case.
$ajax_html_ids = explode(',', $_POST['ajax_html_ids']);
}
foreach ($ajax_html_ids as $seen_id) {
// We rely on '--' being used solely for separating a base id from the
// counter, which this function ensures when returning an id.
$parts = explode('--', $seen_id, 2);
Expand Down

0 comments on commit 005708c

Please sign in to comment.