Jump to:

10990 Posts in 2727 Topics by 1818 members

All other Modules

SilverStripe Forums » All other Modules » Uploadify + jQuery Form plugin

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 1055 Views
  • beezer
    Community Member
    16 Posts

    Uploadify + jQuery Form plugin Link to this post

    I am using the uploadify module on a frontend form and everything works fine except that I've run in to some problems submitting the form via ajax (the form is in a modal and I can't really refresh the whole page).

    With the images being uploaded on selection it works fine to then submit the form using ajaxForm() but if I set the uploadOnSubmit parameter on the MultipleFileUploadField the form is submitted to a blank page instead.

    Form code:

    function __construct($controller, $name) {
    $fields = new FieldSet(
    $images = new MultipleFileUploadField('Images', _t('UploadForm.IMAGES', 'Images'))
    $actions = new FieldSet(
    new FormAction('doupload', _t('UploadForm.UPLOAD', "Upload"))
    parent::__construct($controller, $name, $fields, $actions);
    public function doupload($data, $form) {
    $memberID = Member::currentUserID();
    if(isset($data['Images']) && is_array($data['Images'])) {
    foreach($data['Images'] as $id) {
    if($file = DataObject::get_by_id("File", (int) $id)) {
    $bookImage = new BookImage();
    $bookImage->ImageID = $file->ID;
    $bookImage->MemberID = $memberID;
    $response['success'] = True;
    $response['message'] = _t('CartController.UPLOADSUCCESS', 'Your upload was successful!');


    dataType: 'json',
    success: function(data) {
    var url = window.location.pathname + '/show_mygallery';
    $('#ImageList').load(url, function() {
    // Clear uploadify form
    $('#UploadForm_UploadForm .inputs input').remove();
    $('#UploadForm_UploadForm .upload_previews li').remove();

    and here is the code in uploadify_init.js that submits the form by-passing the ajaxForm binding, line 61:

                onAllComplete : function(event) {
                   $e = $(event.currentTarget);
                   $container = $e.parents('.UploadifyField:first');
                   if($e.metadata().upload_on_submit) {


    Am I missing something or is there a better way to go about this?


  • beezer
    Community Member
    16 Posts

    Re: Uploadify + jQuery Form plugin Link to this post

    sspaste with better formatting: http://www.sspaste.com/paste/show/4e84b2e24d593

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.