If a field or extra field has a negative weight it won't display in a form but it also won't show an error. In my case my title (extra) field was -1, no title textfield would display, and it wouldn't pass validation since the title was required.

I did a temporary fix in _drupalgap_form_render_elements by telling DrupalGap to treat any negative weights as 0.

Comments

tyler.frankenstein’s picture

Title: Fields in _drupalgap_form_render_elements with negative weights don't display » DrupalGap Forms API Does not Handle Negative Weights
Status: Active » Needs work
sanchiz’s picture

This happens when content_weighted have elements with negative weight, and JavaScript arrays doesn't support negative indexes. Length of array always 0, because Array.prototype.length it's not counter of rows, it's the largest index of array(exclude negative indexes).

sanchiz’s picture

Here's a pull request to fix that issue: https://github.com/signalpoint/DrupalGap/pull/369

sanchiz’s picture

Status: Needs work » Needs review
tyler.frankenstein’s picture

Status: Needs review » Closed (fixed)

Thank you @lifeinpoetry for reporting the problem, and @sanchiz for the code fix.

Grab the latest bin/drupalgap.js file for the fix, otherwise it will become available in the next recommended release.

http://drupalgap.org/download