Jump to:

7937 Posts in 1537 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Save button disabled

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 536 Views
  • cmc
    Avatar
    Community Member
    23 Posts

    Save button disabled Link to this post

    I have two similar DOMs for different pages. Both have nested FileDataObjectManagers. In one of them the "Save" button is disabled in the popup once a file has been added. The other works fine, file or no file.

    In the broken Popup, form data can be saved by putting one's cursor in a textfield and pressing return.

    As far as I can tell, the problem is that the "</form>" tag is being inserted before the "Save" button div in the broken Popup, and after the "Save" button div in the working Popup.

    Any ideas?

  • UncleCheese
    Avatar
    4085 Posts

    Re: Save button disabled Link to this post

    Can you post your code and/or a screenshot?

    ---------------
    Silverstripe tips, tutorials, screencasts, and more. http://www.leftandmain.com

  • cmc
    Avatar
    Community Member
    23 Posts

    Re: Save button disabled Link to this post

    I don't see a way to add an image, but here is the code.

    CourseAdvertisement class - this is the main class for the DOM popup that has the "Save" button that doesn't work.

    class CourseAdvertisement extends DataObject {
    public static $db = array (
    'CourseName' => 'Text',
    'CourseDescription'=> 'HTMLText',
    'CourseVideo' => 'HTMLText',
    'CourseImageAltText' => 'Text',
    'CourseAdditionalDescription' => 'HTMLText'

    );

    static $has_one = array (
    'CourseImage' => 'Image',
    'CourseSalesPage' => 'CourseSalesPage'
    );

    static $has_many = array (
    'CourseOptions' => 'CourseAdvertisementItem',
    'Files' =>'CourseAdvertisementFile'
    );

    public function getCMSFields() {
    $files = new FileDataObjectManager (
    $this,
    'Files',
    'CourseAdvertisementFile',
    'File',
    array(
    'FileName' => 'Name',
    'FileDescription' => 'Description'
    )
    );
          $files->allowUploadFolderSelection = false;
          $files->setUploadFolder('Uploads/CourseSalesFiles');
    $files->setAddTitle('File');

    $buynowButtons = new DataObjectManager (
    $this,
    'CourseOptions',
    'CourseAdvertisementItem',
    array (
    'ItemDescription' => 'Description',
    'ItemPrice' => 'Price',
    'ItemButtonCode' => 'Buy Now Button Code'
    )
    );
    $buynowButtons->setAddTitle('Sales Option');

    return new FieldSet(
    new TextField('CourseName', 'Name'),
    new SimpleHTMLEditorField('CourseDescription', 'Description'),
    new TextField('CourseVideo', 'Video Embed Code (Format: [Vimeo id= width=360 height=210]Description[/Vimeo])', '[Vimeo id= width=360 height=210]Description[/Vimeo]'),
    new ImageField('CourseImage', 'Image', Null, Null, Null, 'Uploads/CourseSalesImages'),
    new TextField('CourseImageAltText', 'Alternate Text for Image'),
    new SimpleHTMLEditorField('CourseAdditionalDescription', 'Additional Description (below small image on right)'),
    $buynowButtons,
    $files
    );

    }
    }

    CourseAdvertisementItem class - nested DOM

    class CourseAdvertisementItem extends SalesItem {
    public static $db = array (
    );

    static $has_one = array (
    "CourseAdvertisement" => "CourseAdvertisement"
    );

    }

    SalesItem class - nested DOM.

    class SalesItem extends DataObject {
    public static $db = array (
    'ItemDescription' => 'HTMLText',
    'ItemPrice' => 'Text',
    'ItemButtonCode' => 'HTMLText'
    );

    static $has_one = array (
    );

    public function getCMSFields() {
    return new FieldSet(
    new TextareaField('ItemDescription', 'Description'),
    new TextField('ItemPrice', 'Price'),
    new TextField('ItemButtonCode', 'ButtonCode')
    );
    }
    }

    CourseAdvertisementFile class - Another nested DOM. Save button stops functioning once a file has been added.

    class CourseAdvertisementFile extends PageFile {
    public static $db = array (
    );

    static $has_one = array (
    'CourseAdvertisement' => 'CourseAdvertisement'
    );

    }

    PageFile class

    class PageFile extends DataObject {
    public static $db = array (
    'FileName' => 'Text',
    'FileDescription' => "Text"
    );

    static $has_one = array (
    'File' => 'File'
    );

    public function getCMSFields() {
    return new FieldSet(
    new TextField('FileName', 'File Name'),
    new FileIFrameField('File'),
    new TextareaField('FileDescription', 'File Description')
    );
    }
    }

    536 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.