1. Fabrik 3.7 is now available. This version contains critical security updates, please update as soon as possible. Please remember to backup your site before updating, we also recommend testing your updates on development sites if possible.
  2. We had to restore the site around midday (CST) on Wed 7/26 from a backup approximately 8 hours old. So a few posts in the forums were lost. You may want to check to see if you need to re-post anything.
  3. The release of Fabrik for J! 3.8 is not yet ready. Do not update your sites to J! 3.8 until this notice is removed.

How to display images from one Form to another form

Discussion in 'Professional Support' started by sunnyjey, Sep 10, 2017.

  1. sunnyjey

    sunnyjey New Member

    Level: Professional
    I would like to display uploaded images from one Form (Form1) image to other Fabrik Form (Form 2).

    User during submission of Form2 should be able to view images submitted in Form1 through Pop up or Modal window. I have common Field ID to check and auto populate other text fields from Form1 to Form2.

    What would be best way to display images (jpeg/jpg) uploaded in Form1 (Detail1) to Form2 (not in details2) ?

    Note: I have gone through WIKI as well as Forum post, but couldn't find similar thread.
     
  2. sunnyjey

    sunnyjey New Member

    Level: Professional
    Friendly bump..

    My developer team is waiting for this reply.
     
  3. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Sorry, I got caught up in a hurricane trying to get home from South Carolina.

    I'm thinking about this ...

    Are all the images in form1 uploaded to a single folder?

    -- hugh
     
  4. sunnyjey

    sunnyjey New Member

    Level: Professional
  5. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    You could look at using an 'image' element in form2, with the (Joomla relative) path to your upload folder as the default.

    Won't get you the modal / popup, but it's a starting point.

    -- hugh
     
  6. sunnyjey

    sunnyjey New Member

    Level: Professional
    In form A, the image is stored in separate folder based on /images/stories/{invoiceid} upload directory.

    I have created image Element in Form B with default directory /images/stories/{invoiceid} . How do I auto fill {invoiceid} through Auto fill PHP plugin on LOAD of Form B.
     
  7. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    You can't. Which is why i asked if the images are uploaded to a single folder. But it seems that you are using multiple folders, depending on the value of an element on form1.

    The image elements root folder is built on the server side during form load. It can't be updated from the browser side.

    Just so I understand fully ... at what point is your common Field ID set when you load form2? Is it known on page load, or does the user select it in the form?

    -- hugh
     
  8. sunnyjey

    sunnyjey New Member

    Level: Professional
    User enter the invoice id and mapped data is then populated on FormLoad through auto fill plugin.

    If you want I can give access to my test server, so that you can see yourself.
     
  9. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    The image element doesn't have a built in feature for updating the folder path automatically.

    However, it does have a method for doing that, which is usually triggered by the UI, if "Front end select" is enabled, and the user selects a different folder.

    So it might be possible to trigger that by hand, using some JS that fires when an autofill is finished.

    You'd need to create a file ./components/com_fabrik/js/form_X.js (replace X with the numeric ID of your form), and paste this into it:

    Code (Text):

    requirejs(['fab/fabrik'], function() {
       Fabrik.addEvent('fabrik.form.autofill.update.end', function(form, data) {
          form.formElements.get('yourtable___image').changeFolder('/full/path/to/images/' + data.yourtable___invoiceid);
       });
    });
     
    Replace yourtable___image with the full element name of your image element, and yourtable___invoiceid with the full element name of the i9nvoiceid.

    I can't promise it'll work first time, but once you have that code in place, I can debug it.

    BTW, looking at the image element code, I *really* need to fix it so it doesn't use full (rather than relative) paths. That's some code we wrote about a decade ago, and I've never really looked at it since. The way it's written is kind of horribly insecure. I'll try and find some time this week to do that.

    -- hugh
     
  10. sunnyjey

    sunnyjey New Member

    Level: Professional
    Is there any alternate way through calc element

    To build query and run it where to enter invoiceid. Based on it the query to get images path. Then to make html img tags and show images.

    Is this possible ?
     
  11. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Maybe I'm misunderstanding what you are trying to do. Do you want people to be able to select an image, or simply see all uploaded images?

    -- hugh
     
  12. sunnyjey

    sunnyjey New Member

    Level: Professional
    Code (Text):
    requirejs(['fab/fabrik'], function() {
       Fabrik.addEvent('fabrik.form.autofill.update.end', function(form, data) {
          form.formElements.get('report___doctorletter').changeFolder('/home/canpath/public_html/images/stories/' + data.report___patientid);
       });
    });
    I tried this, but didn't work.

    This is scary. Please find time and try to make this image Element secure. Please keep this THREAD open, so that I can remind you again in week, in case if you didn't get time to fix its security.

    People should simply see all uploaded images. No selection or edit or store to DB is required in Form B.

    At last, I have GOOD NEWS.

    Yesterday, my PHP developer just placed the {invoiceID} in the Mapping field of Autofill plugin. And it worked !!! I can see uploaded images from Form A in Form B. The issue is solved.
     

Share This Page