CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • File Upload as mandatory / required field? (CiviCRM 3.1.2 / Drupal 6.15)
Pages: [1]

Author Topic: File Upload as mandatory / required field? (CiviCRM 3.1.2 / Drupal 6.15)  (Read 2284 times)

kebap

  • I’m new here
  • *
  • Posts: 14
  • Karma: 1
    • UN-SPIDER Knowledge Portal
  • CiviCRM version: 4.4.5
  • CMS version: Drupal
File Upload as mandatory / required field? (CiviCRM 3.1.2 / Drupal 6.15)
February 22, 2010, 08:11:44 am
After I've configured a new event with some custom data and profile fields, there's a bug in checking the form - All the required fields are checked correctly, only the required upload of a document fails. So the form isn't complaining when no document was selected, although I set this field to required both in custom data and profiles. Are there any settings I might have not seen?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: File Upload as mandatory / required field? (CiviCRM 3.1.2 / Drupal 6.15)
February 22, 2010, 08:43:15 am

if i'm not mistaken this is a bug in civicrm (i could not find the open issue).

can you try to reproduce this on the demo machine and see if it still exists. the fix for this is a bit non-trivial i think (and hence its still open). i might be totally wrong here :(

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

kebap

  • I’m new here
  • *
  • Posts: 14
  • Karma: 1
    • UN-SPIDER Knowledge Portal
  • CiviCRM version: 4.4.5
  • CMS version: Drupal
Re: File Upload as mandatory / required field? (CiviCRM 3.1.2 / Drupal 6.15)
February 22, 2010, 08:57:44 am
yup, reproducable here: http://drupal.demo.civicrm.org/civicrm/event/register?id=8&reset=1 :'(
Ok, now it would be interesting to get in touch with this non-trivial fix  ;D
Thanks so far!

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: File Upload as mandatory / required field? (CiviCRM 3.1.2 / Drupal 6.15)
February 22, 2010, 09:01:50 am

if this issue is important / crucial to you, please consider investigating and contributing a patch

get in touch with us on IRC if u need help getting started. if not a programmer, hire/recruit a developer to help you with it

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

kebap

  • I’m new here
  • *
  • Posts: 14
  • Karma: 1
    • UN-SPIDER Knowledge Portal
  • CiviCRM version: 4.4.5
  • CMS version: Drupal
Re: File Upload as mandatory / required field? (CiviCRM 3.1.2 / Drupal 6.15)
February 23, 2010, 07:23:27 am
thanks lobo,
I found a workaround, I had to put here: sites/all/modules/civicrm/packages/HTML/Quickform/Rule/Required.php
But I don't like it there - next time CiviCRM updates, my changes are gone - so I am trying to find out, whether I can add this functionality to some hook.
I put following code to line 58 and following.
Code: [Select]
 
$arrayKeys = array_keys($files);
$fileArray = array('name', 'type', 'tmp_name', 'error', 'size'); //
 
if (sizeof(array_diff($arrayKeys, $fileArray)) == 0) {
  if ($value['size'] == 0) {
    return false;
  }
}

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: File Upload as mandatory / required field? (CiviCRM 3.1.2 / Drupal 6.15)
February 23, 2010, 07:39:17 am

do the file required validation in the validate hook

http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+hook+specification#CiviCRMhookspecification-hookcivicrmvalidate

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • File Upload as mandatory / required field? (CiviCRM 3.1.2 / Drupal 6.15)

This forum was archived on 2017-11-26.