Custom form - file upload

(Aska Smietanska) #1

Matrix Version:
Hi, I would like to ask for your help with 2 issues with the file upload field in a Custom form.

  1. “If a user selects a file for upload, then mistakenly fails to complete another ‘required’ field on the same page, the page reloads with the appropriate error message - but now the file upload field has been cleared, making it easy for the user to move on thinking they have attached the file - when they have not - very confusing” - especially for screen reader users.

It was discussed previously on File uploads on multi page forms and There was an error uploading the file - error when form page is refreshed.

Benjamin answer was “It looks like it is a bug (bug_id=4111). It was fixed in 3.24.4.”.
Bart suggested using client-side JS validation on the other required fields.

I would prefer to not to use client-side validation. Is this bug fixed? If not, is there any other way around?

  1. %begin_response_XXXXXX_qy% %end_response% doesn’t work for the upload file on the Thank you page (it works great for all other fields). What keyword should I use?

Cheers, Aska Smietanska

(Serge) #2

@askas could we please get screenshots? @Bart any idea how to fix this or circumvent the issue?

(Bart Banda) #3

The issue of the file getting removed after server-side validation has kicked in and said that you had some other field not filled out, was fixed a while ago, can’t remember what version, but I def can’t replicate it in the latest 5.5 version. It may have been after though.

Response keywords used in a conditional keyword format should def work on the thank you page as well though, so maybe the format you are using is slightly incorrect? Can you show us more details?

(Aska Smietanska) #4

There is a dynamic form “Request information under RtI” which consist of the three forms. Two of them have the upload a file field. When the user selects a radio button with the title of the appropiate form, the fields from not displayed form become “optional” and are not shown on the Thank you - form summary page. This is done by the conditional keywords on the Thank you page:

%begin_response_470201_q6%%question_name_470201_q6% %response_470201_q6%%end_response%%begin_response_470202_q1%%question_name_470202_q1%: %response_470202_q1%%end_response%%begin_response_470202_q2%%question_name_470202_q2%: %response_470202_q2%%end_response%%begin_response_470202_q3%%question_name_470202_q3%: %response_470202_q3%%end_response%%begin_response_470228_q1%%question_name_470228_q1%: %response_470228_q1%%end_response%%begin_response_470228_q2%%question_name_470228_q2%: %response_470228_q2%%end_response%%begin_response_470228_q3%%question_name_470228_q3%: %response_470228_q3_file_size%%end_response%%begin_response_470229_q1%%question_name_470229_q1%: %response_470229_q1%%end_response%%begin_response_470229_q2%%question_name_470229_q2%: %response_470229_q2%%end_response%
%begin_response_470229_q3%%question_name_470229_q3%: %response_470229_q3_file_size%%end_response%
%begin_response_470211_q2%%question_name_470211_q2%: %response_470211_q2%%end_response%%begin_response_470211_q5%%question_name_470211_q5%: %response_470211_q5%%end_response%%begin_response_470211_q3%%question_name_470211_q3%: %response_470211_q3%%end_response%%begin_response_470211_q4%%question_name_470211_q4%: %response_470211_q4%%end_response%
The two below are the upload file fields and it seems to not work with the conditional keyword. I also tried to put there a field keyword without “_file_size” e.g. %response_470228_q3% but it is not working either.
What should I use for the upload a file field in the conditional?

%begin_response_470228_q3%%question_name_470228_q3%: %response_470228_q3_file_size%%end_response%
%begin_response_470229_q3%%question_name_470229_q3%: %response_470229_q3_file_size%%end_response%

The name of the upload file field of the active form is “Confirmation of authority to release information (attach file)”

The name of the upload file field of the non-active form is “Upload file - a confirmation of authority to release information”. Only the first one should be shown on the Thank you page but both of them are displayed.

Please have a look at the provided video and screenshot.

(John gill) #5

This is because for an empty file field %response_470229_q3% is just a string, and has a value of “No file uploaded”.

You’ll need to test the value of that string to see if it’s a real file or not. The below seems to work as a simple starting point.

%begin_response_470229_q3^neq:No file uploaded%
  %question_name_470229_q3%: %response_470229_q3_file_size%

(Aska Smietanska) #6

Thank you very much, John! your solution works perfectly

(Aska Smietanska) #7

@Bart We found out that the same case is with the Date/Time field in a Custom form - the entered date and time is wiped out after submitting and when there is another mandatory field not filled in. As a workaround, we use a text field instead. Has this bug been fixed in the 5.5 version? If yes, I have another question. Has been Linked CSS Design Area deprecated or removed in 5.5?

(Bart Banda) #8

I’m not sure, I don’t recall that still being an issue. You could download the latest version of matrix as a VM and maybe try and replicate there and let us know if it’s still not working for you?
If it isn’t, please let us know exact replication steps so we can try and replicate the bug locally and fix it.

It has been deprecated but not yet removed.