1. We suggest you do NOT update to Joomla 3.8.10 until we can resolve an issue it causes with caching in Fabrik. If you do install it, you'll need to disable Joomla's "System Cache" in the global System settings.
  2. Apologies for the recent server outage, a planned migration by our host provider to a new location turned into a bit of a nightmare.

Form button 'Save as copy' - Option 'Default on Copy' doesn't seem to work

Discussion in 'Professional Support' started by Borox, Apr 13, 2018.

  1. Borox

    Borox Member

    Level: Professional
    Hi,

    I used the button 'Save as copy' to quickly copy a specific form, it works but, I have a problem with the fileupload elements because the files themselves are not copied, we get an alias of the files ( the copy and the source point towards the same file).
    So, I wanted to exclude the fileupload elements from the copy. In order to do that I put 'Default on Copy' to Yes upload_2018-4-13_10-50-12.png but the fileload elements are still copied.

    1 - Is there a way to avoid the copy of a specific element when we use the button 'Save as copy'
    2 - Would it be possible for fileupload element to have a real copy, I mean, a copy of the file?

    Thanks.
     
  2. Borox

    Borox Member

    Level: Professional
    I checked with another type of element, with a 'field' the option 'Default on Copy' works ( the value is not copied), so it seems that it doesn't work only (at least) with filepload.
     
  3. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Professional
    Are you doing the copy from a list (using the Copy list plugin) or from the form (using the Save as Copy button)?

    -- hugh
     
  4. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Professional
    Oh, you did say in your question. Sorry, still on my first cup of coffee.

    -- hugh
     
  5. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Professional
    OK, try this:

    https://github.com/Fabrik/fabrik/commit/6097de2e7310daae3ed7ba5226521addf2be8fdb

    For your second question ...

    It'd be possible, but I'd probably need to charge for an hour or two's work to do it, as it's not trivial to implement. Mostly because I have to account for s3 storage as well as local, plus dealing with multiple AJAX uploads.

    -- hugh
     
  6. Borox

    Borox Member

    Level: Professional
    I try the fix and I'll let you know

    Thanks Hugh
     
  7. Borox

    Borox Member

    Level: Professional
    Thanks Hugh, the fix works great!

    For the moment excluding the files from the copy is enough for me, I'll see later if I need a real copy of them.
     
  8. Borox

    Borox Member

    Level: Professional
    I've noticed something, which happened, I think, for all the elements:

    It works, the fileupload's elements are not copied, but if you send an email using the 'form email plugin', when you copy a form, you still get the values. The variable 'data' (I use $this->data[...] to put the values in the email) seems not to be update and still contains a value that you find in the email.

    Do I need to use another variable then 'data'?

    Thanks
     
  9. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Professional
    Hmmm, yeah, I can see why that happens.

    I think it's fixable. I'll take a look as soon as I get a chance this week.

    -- hugh
     
    Borox likes this.
  10. Borox

    Borox Member

    Level: Professional
    @cheesegrits Hello Hugh,

    Have you been able to fix it?

    Thanks.
     
  11. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Professional
    Ooops, sorry. OK, looking at it now. Should have a fix by this evening.

    -- hugh
     
    Borox likes this.
  12. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Professional
    I'm testing a fix locally, I'll commit it later today.

    -- hugh
     
  13. Borox

    Borox Member

    Level: Professional
    OK Hugh, I'll test as soon as the fix is available
     
  14. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Professional
  15. Borox

    Borox Member

    Level: Professional
    Hi Hugh,

    I've done a full github update but no change, I still have in the first email sent the values ( not in the next emails)
     

    Attached Files:

  16. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Professional
    Can you paste the template code you are using.

    -- hugh
     
  17. Borox

    Borox Member

    Level: Professional
    Hi Hugh,

    Here is the code used to get the pictures in the email sent after the form copy:
    Code (Text):
    echo "<img src=".JURI::base().$this->data['contrats___contrat_photo_raw'].">";
     
    Right after the copy the picture appears, even though the files is not in the new form ( the one copied).

    In the email right after the copy:
    [​IMG]

    In the email after a 'save' without touching anything:
    [​IMG]

    Thanks.
     
    Last edited: May 21, 2018
  18. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Professional
    Ah, try just using the non _raw, which should already be an img tag (or empty).

    -- hugh
     
  19. Borox

    Borox Member

    Level: Professional
    Hi Hugh,

    It doesn't work in my case.
    I used the template debug.php to see the variables and there is nothing in the non _raw one ( neither if I'm supposed to have an image or if I'm not). That's probably why I used the _raw version in the first place.

    I haven't made a copy, so I was supposed to have something in non raw variable:
    upload_2018-5-23_19-2-37.png
    In the raw:
    upload_2018-5-23_19-3-53.png

    Weird.
     
  20. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Professional
    OK, I'll keep working on it.

    -- hugh
     

Share This Page