• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

How to display images from one Form to another form

sunnyjey

Active Member
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.
 
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
 
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
 
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.
 
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
 
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.
 
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:
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
 
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 ?
 
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
 
Code:
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);
   });
});
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:
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.

I tried this, but didn't work.

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.

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.

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?

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.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top