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

Data type not validated in custom form fields #671

Closed
srutto opened this issue Jul 5, 2012 · 14 comments
Closed

Data type not validated in custom form fields #671

srutto opened this issue Jul 5, 2012 · 14 comments
Assignees
Milestone

Comments

@srutto
Copy link
Contributor

srutto commented Jul 5, 2012

Steps to reproduce:

  1. Login to the admin panel
  2. Go to Manage/Forms which will take you to the forms page. Click on Edit Form Fields -> http://i.imgur.com/H7emp.png
  3. Add a new field. Enter the field details and select the data type of the field, eg Numeric, and save
  4. Go to Submit a Report page and create a report. Enter the data in the new field that was created as free text

Expected Result:

An error message should be thrown that only numeric data type is expected for the field.

Actual Result:

Report is saved. No error thrown.

Tested on version 2.5. Tested with the other data types and got the same results. The values submitted in the custom field are not validate. All data types entered by the user is submitted regardless of the data type set in the admin end.

@rjmackay
Copy link
Contributor

@srutto Theres nowhere near enough if here to debug. Can you clean up this bug report?
A good report should have:

  • steps to reproduce the issues
  • Expected result
  • actual result
  • Version of the software you were testing on
  • Screen shots if appropriate

See https://developer.mozilla.org/en-US/docs/Bug_writing_guidelines for some more details on how to write a good bug report.

@PoPoutdoor
Copy link

I think this is about custom form fields.

@rjmackay
Copy link
Contributor

rjmackay commented Oct 2, 2012

@srutto thanks for the update description.. much better!

rjmackay added a commit to rjmackay/Ushahidi_Web that referenced this issue Nov 20, 2012
* Actually return sane error messages
* Push errors directly into $post object
* Bind all error to 'custom_field' rather than trying to bind to
  individual fields as this didn't work and meant no errors were displayed
* Still a bit broken since only the last error will get displayed,
  not great if you have 10 errors and only see 1
* Fix unit test to grab the errors from the $post object
@ghost ghost assigned rjmackay Nov 26, 2012
aoduor added a commit to aoduor/Ushahidi_Web that referenced this issue Apr 11, 2013
aoduor added a commit to aoduor/Ushahidi_Web that referenced this issue Apr 11, 2013
@manwinder
Copy link

@aoduor @elle-espere

My deployment address is https://indiaoye.crowdmap.com/
I have added a mobile field to the submit report form, selected a numeric field (10 digits) and marked it as 'Required'
However no validation applies - I could submit a report with blank mobile no., with alphanumeric data and with more than 10 digits.

Request you to add my report to the above repository.

@aoduor
Copy link
Member

aoduor commented Apr 11, 2013

@manwinder working on a fix for this. As I had earlier mentioned, this fix will be available once the next version of Ushahidi is released, on April 30th. It will then be made available on crowdmap thereafter.

aoduor pushed a commit to aoduor/Ushahidi_Web that referenced this issue Apr 11, 2013
* Actually return sane error messages
* Push errors directly into $post object
* Bind all error to 'custom_field' rather than trying to bind to
  individual fields as this didn't work and meant no errors were displayed
* Still a bit broken since only the last error will get displayed,
  not great if you have 10 errors and only see 1
* Fix unit test to grab the errors from the $post object
aoduor pushed a commit to aoduor/Ushahidi_Web that referenced this issue Apr 11, 2013
* Actually return sane error messages
* Push errors directly into $post object
* Bind all error to 'custom_field' rather than trying to bind to
  individual fields as this didn't work and meant no errors were displayed
* Still a bit broken since only the last error will get displayed,
  not great if you have 10 errors and only see 1
* Fix unit test to grab the errors from the $post object
aoduor added a commit that referenced this issue Apr 12, 2013
Fix custom form fields validation #671
@manwinder
Copy link

@aoduor - wanted to bring the following to your notice too (Crowdmap)

I have added 'Mobile No.' as an additional field in the 'Submit Report' page.
However, the field does not appear some times - at other time, one can see it.

The appearing of the field is very random - hope this is in your notice and will get resolved in the new version.

@rjmackay
Copy link
Contributor

@manwinder that sounds like the permissions (who can edit, who can view) on the mobile field might be set incorrectly. Does it appear differently when your logged in/logged out?

@manwinder
Copy link

@rjmackay I am aware about the feature to set permissions. But here I am referring to the 'Field' itself. As mentioned earlier I have added 'Mobile Field' (Screen shot of settings attached).
But when I 'Submit Report', the 'Mobile Field' itself does not appear sometimes. This time it did appear luckily (screen shot attached'. But I'll send you a screen shot when I am able to reproduce the issue.
Add Field Setting
Mobile Field

@manwinder
Copy link

@rjmackay Here is the screen shot of the report page where the Mobile field is not visible despite of not changing any settings.
mobile field dissappeared

@rjmackay
Copy link
Contributor

@manwinder this is really just issue #744 and should be fixed soon.

@manwinder
Copy link

@rjmackay @elleespere Alright - though I couldn't understand #744 completely, but yes I realize the problem may be with Login. My settings of the private field are
Who Can Report - Anyone
Who can view - Sadmin

My understanding of the above setting is that anyone should be able to submit the mobile number, thus 'Mobile No. Fiedl' should be visible to all at 'Submit Report' page, irrespective of the login.
After a report has been, the mobile numbers of the reporters should not be visible to everyone (confidentiality reasons). But should be visible only to the designated few(admin/ Sadmin) for verification etc.

Kindly let me know, if my understanding is correct and if after the fix, this functionality would work as per my understanding / requirement ?

@rjmackay
Copy link
Contributor

You're understanding is correct. This should work once 2.7 is released

@ghost
Copy link

ghost commented Apr 21, 2013

Thanks @rjmackay =)

@rjmackay
Copy link
Contributor

@manwinder please post that issue to the Ushahidi Android repo

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

5 participants