Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

UploadField goes unusable with Userforms #135

Closed
suntrop opened this Issue Jun 9, 2013 · 2 comments

Comments

Projects
None yet
3 participants

suntrop commented Jun 9, 2013

Problem: UploadField shows mail, subject instead of assets
What I did: Extend Page.php with some UploadFields
Expected result: See assets when clicking the button to attach them to my page

There seems to be a bug, if you use an UploadField in a Page and use Userforms.

In my Page.php I extended the CMS with some photo relation fields:
$fields->addFieldToTab('Root.Photos', new HeaderField('BigPicturesHeader', 'Background', '2')); $fields->addFieldToTab('Root.Photos', new LiteralField('Hintergrundbilder', 'Select Photo.')); $fields->addFieldToTab('Root.Photos', $BigPicture1 = new UploadField('BigPicture1', 'Background #1')); $BigPicture1->setConfig('allowedMaxFileNumber', 1); $BigPicture1->setFolderName('Fotos'); $BigPicture1->setConfig('previewMaxWidth', 180); $BigPicture1->setConfig('previewMaxHeight', 180); $fields->addFieldToTab('Root.Photos', new UploadField('BigPicture2', 'Background #2')); $fields->addFieldToTab('Root.Photos', new HeaderField('SmallPicturesHeader', 'Small photos', '2')); $fields->addFieldToTab('Root.Photos', new LiteralField('Fotos', 'Select small photos.')); $fields->addFieldToTab('Root.Photos', new UploadField('SmallPicture1', 'Photo (small) #1'));

Within a userdefinedform Page I can't select images anymore. Instead of getting the rows/columns for the assets I see columns for E-Mail, Subject … (see screenshot)

Using SS 3.0 and downloaded the proper userforms version from SS-Website
http://www.silverstripe.org/user-forms-module/

userforms-bug

Here the same…

Contributor

kmayo-ss commented Aug 15, 2013

Replicated the bug on SS 3.0 using branch 1.0 of userforms raising a patch for a fix for this will need to test details of patch are below

  •           UserDefinedForm_EmailRecipient::$summary_fields=array(
    
  •                   'EmailAddress' => _t('UserDefinedForm.EMAILADDRESS', 'Email'),
    
  •                   'EmailSubject' => _t('UserDefinedForm.EMAILSUBJECT', 'Subject'),
    
  •                   'EmailFrom' => _t('UserDefinedForm.EMAILFROM', 'From')
    
  •           // Set the summary fields of UserDefinedForm_EmailRecipient dynamically via config system
    
  •           Config::inst()->update(
    
  •                   'UserDefinedForm_EmailRecipient',
    
  •                   'summary_fields',
    
  •                   array(
    
  •                           'EmailAddress' => _t('UserDefinedForm.EMAILADDRESS', 'Email'),
    
  •                           'EmailSubject' => _t('UserDefinedForm.EMAILSUBJECT', 'Subject'),
    
  •                           'EmailFrom' => _t('UserDefinedForm.EMAILFROM', 'From'),
    
  •                   )
            );
    

kmayo-ss added a commit to silverstripe-terraformers/silverstripe-userforms that referenced this issue Aug 15, 2013

wilr added a commit that referenced this issue Sep 7, 2013

Merge pull request #152 from silverstripe-rebelalliance/fixIssue135
BUG Fixes #135 When extending form to include photos email summary fieds appear in GridField

@wilr wilr closed this in 340bd89 Sep 7, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment