In the form I'm creating, I want the user to either upload a file from their computer, or insert a url from the web. So I created 2 fields, but really only one of the is required. How can I do this in a user friendly way?
In the form I'm creating, I want the user to either upload a file from their computer, or insert a url from the web. So I created 2 fields, but really only one of the is required. How can I do this in a user friendly way?
I would add a radio button before those fields show up, asking if you want to "upload or add URL" - then, with conditional logic, show the upload field for one choice and the URL field for the other choice. Make all 3 fields required (the decision, the URL field and the upload field) and with conditional logic, the one required but hidden field that is not being used will not trigger a validation error even though it's empty. It's not really counted.
Does that work well enough for you?
Hi Chris,
Thank you for your suggestion. I think it might be a good solution (I still have to consult our designer for any design issues), but it's not working....
I added the radio button field, and then applied the conditional logic to the upload file field. But then when I open the form - all I get is a blank page...
If you are getting a blank page, chances are it's a 500 Internal Server error, and probably not related to the conditional logic. If you have access to server logs, you should be able to see what error is being recorded and triggering the blank page.
Please post a link to your form if you would like us to take a look at it. But if it is an Internal Server Error, you will need to display errors or enable logging and see what the error actually is. The blank page just tells you there was a problem processing the php code.
Ok, I found the problem. I had made a dedicated Page template, and had neglected to call wp_head(). Now I called it, and the page loads fine. Thank you!
There you go. Thanks for posting your solution. It will serve as a good reminder to include wp_head(). Thanks and have a good day.