Skip to content
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

Website throws an errors when you delete the single contacts row and then submit #315

Closed
seav opened this issue Jul 5, 2016 · 14 comments
Closed
Assignees
Milestone

Comments

@seav
Copy link
Contributor

seav commented Jul 5, 2016

For the contacts sub-form in both the add organization and add project forms, the single contacts row has a delete contact icon to the right (circled below). Clicking on it, and then submitting the form results in an AttributeError being raised. This still happens even if you delete the row, and then click on "Add contact" afterwards to add back the single row. I think we should remove the delete contact icon when only 1 row is shown. Update: This error only occurs if the name field is left blank.

screen shot 2016-07-05 at 08 52 40
screen shot 2016-07-05 at 08 53 34

@seav seav added the bug label Jul 5, 2016
@seav seav added this to the Version 0.1 milestone Jul 5, 2016
@oliverroick
Copy link
Member

Which browser are you on? I can't reproduce it on Mac/Chrome.

@seav
Copy link
Contributor Author

seav commented Jul 6, 2016

Linux/Firefox

@oliverroick
Copy link
Member

Are there any JavaScript errors logged?

@seav
Copy link
Contributor Author

seav commented Jul 6, 2016

Just a couple of warnings, both "Empty string passed to getElementById()." when I click on the delete icon. Unfortunately, these are logged against JQuery and datatables so I'm not sure what is the empty string supposed to contain.

Anyway, I actually get this warning on a lot of the interactive elements, such as whenever I click on the private-public widget on the project add details form.

@seav
Copy link
Contributor Author

seav commented Jul 6, 2016

Here's more information on the error:

In template /vagrant/cadasta/templates/organization/organization_add.html, error at line 23
'NoneType' object has no attribute 'get'

22            <div class="modal-body">
23              {% include "organization/organization_form.html" %}
24            </div>

@seav
Copy link
Contributor Author

seav commented Jul 6, 2016

Tried it now with Linux/Chromium and I get the same error. But this time there are no JS warnings or errors on the console.

@seav
Copy link
Contributor Author

seav commented Jul 6, 2016

OK, I tried this on the Staging website and I don't get an error, but I get no form, which is indicative of the same error (organization/organization_form.html is not being rendered).
screen shot 2016-07-06 at 16 59 25

@oliverroick
Copy link
Member

I tried this on Chrome, Firefox, Safari on Mac, it works for both the Organization and the Project forms. @Cadasta/cadasta-dev Can someone please give this a try on different platforms/browsers?

@wonderchook
Copy link
Contributor

No issues on Firefox and Chrome on Windows.

@seav could you make a screencast of what you are doing to make sure we are doing the same thing?

@wonderchook wonderchook modified the milestones: Post July Release Sprint, Version 0.1 Jul 8, 2016
@seav
Copy link
Contributor Author

seav commented Jul 9, 2016

Screenshot:
gifrecord_2016-07-09_082344

@seav
Copy link
Contributor Author

seav commented Jul 9, 2016

Tried this on the following and was able to reproduce it:

  • Linux/Firefox
  • Linux/Chromium
  • Windows 7/Chrome
  • Android/Firefox

@wonderchook
Copy link
Contributor

In your screenshot you aren't adding an organization name. If I leave that blank then yes it creates and error, but I think it is a different one than deleting the contact info.

@seav
Copy link
Contributor Author

seav commented Jul 9, 2016

I would expect that in my screenshot, I would just get the "This field is required" error message instead of a website error. It seems that the combination of the missing name and the deleted contact row results into the website error. There's probably a missing guard condition in the platform somewhere.

@seav
Copy link
Contributor Author

seav commented Jul 9, 2016

So there are 2 conditions required to show the bug:

  1. Leave the name field blank
  2. Delete the contact row

So here's a matrix of what happens depending on the conditions when the form is submitted.

Name is not blankName is blank
Contact row is not deletedSubmission is OKRequired name error message is returned
Contact row is deletedSubmission is OKExpected: Required name error message is returned
Actual: Website throws an error

@oliverroick oliverroick self-assigned this Jul 19, 2016
ian-ross added a commit that referenced this issue Jul 20, 2016
Fixes #315 -- Set _errors when contact is removed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants