Hi All,
I'm trying to find a solution to the following problem.
I am using an Asset Listing page to list all Form Submissions under a Root Node.
When looping through the Form Submissions, I'm also trying to output an image file (that was part of the submission). I'm trying to populate an image src field by using the provided image filename from the submission form.
ie. <img src="%question_answer_121651_q5%" />
The problem is Matrix generates more then just the filename when it prints this answer, it also generates a file type and file size. e.g "photo1.jpg, type image/jpeg, 51.5 KB". I'm trying to extract just the first part of the answer, the filename. I was heading down the path of keyword modifiers but can't find anything that will do the trick?
Any suggestions?
Thanks
Steve
Hi Steve,
I think you can do one of the 2 things here :
- Use a complex keyword modifier like : %question_answer_121651_q5^replace:(,\stype\s[a-z]\/[a-z,]\s[0-9\.]*\s[KMB]{2}):% but here depending upon the Matrix version you are on you may be affected by #5618 Keyword modifier doesn’t work on all keywords for the Form Submission asset bug.
OR
- Under “System Configuration” > “File Preferences” , change the format for “File Summary Format”. Check #5618 Keyword modifier doesn’t work on all keywords for the Form Submission asset out for more information.
Hope this helps.
Ash
Hi Ash,
Thanks for your advice, I tried to change to File Format summary but it didn't change the output on the front end. Also had problems with the regex, when I have more time I'll try and get this working, it seems like the way to go.
For the moment, I have ended up using jquery to split the string, and then change the src attribute of the image to the first item in the split array, which is the filename.
<script>
$(document).ready(function() {
$(".myimage").each(function() {
var parts = $(this).attr('rel').split(",");
$(this).attr({'src':parts[0]});
});
})
</script>