Is there a way to require users to answer certain fields in DW Question & Answer Pro? For example, I would like to require users to select a question category. Is there a way to add validation so that the form cannot be submitted without this field being answered?
You can open file wp-content/plugins/dwqa-question-answer/inc/Handle.php
and add following code from line 293:
if ( !$category ) { dwqa_add_notice( __( ‘You must choose category.’, ‘dwqa’ ), ‘error’ ); return false; } if ( !is_user_logged_in() && empty( $_POST[‘_dwqa_anonymous_email’] ) && !is_email( $_POST[‘_dwqa_anonymous_email’] ) ) { dwqa_add_notice( __( ‘You must enter a valid email.’ ), ‘error’ ); return false; }
Please let me know, if you still face their issue, I will access your site and help you resolve it.
I added this code as directed. It did not work. It does not validate anything. The user can still submit the form without answering the question. Since you sent the first response, I have updated from version 1.0.0 to version 1.0.7. I’m not sure if that matters.
You can replace the code in this file with the following code:
http://snippi.com/s/6nqyynv
Just added this code to the line 378.
We added this code. It did not work. I am still able to submit questions without selecting a category. I would actually like to require the name and address as well as the category. Our developer is also following this thread. Please let us know how to implement this.
Please send me your FTP account, I will check and help you resolve this issue.
My FTP account includes access to our online application (not WordPress), which is proprietary. Can you just use my WordPress credentials and edit through the admin interface (https://www.deedclaim.com/wp/wp-admin/).
Yes, give me your account of your site via private answer.
Please login or Register to submit your answer