Hi
I have used the below code to change the status to pending when the Organization changed
jQuery(document).on('cred_form_ready', function(){
jQuery( 'select[name="wpcf-org"]' ).change(function() {
jQuery( 'b.wpcf-request-status' ).text('Pending');
jQuery( 'input[name="wpcf-request-status"][value=3]' ).prop("checked",true);
});
});
Now I would like to update the code to empty/delete the rejection-reason field value( the field type is text), also when the Organization changed.
what I did is
jQuery(document).on('cred_form_ready', function(){
jQuery( 'select[name="wpcf-org"]' ).change(function() {
jQuery( 'b.wpcf-request-status' ).text('Pending');
jQuery( 'input[name="wpcf-request-status"][value=3]' ).prop("checked",true);
jQuery('input[name="wpcf-rejection-reason"]').val('');
});
});
the status changed but the rejection reason not deleted. What is the wrong on jQuery('input[name="wpcf-rejection-reason"]').val('');
Hello, I don't see anything obviously wrong in this code. For a standard single line text field, it should be possible to manipulate the value with jQuery.val(). If the input field is emptied after changing the Organization field, then the empty value should be saved correctly for the rejection reason field when the Form is submitted. If the field is not emptied when the Organization field is changed, then there must be something else going on. Is it possible there is some other custom code interfering in this process, or a caching system holding on to old field values? Perhaps you can try disabling all custom code snippets and all 3rd-party plugins, and activate a default theme like Twenty Twenty One. Then add your custom JS and test again. If the problem is resolved, then you know there is some conflict with another component. Reactivate your other custom code snippets and third-party plugins one by one, testing each time, until the problem returns.
Hi Christian,
thank you for your reply.
I did what you suggested but unfortunately, the text field still not emptied after changing the Organization field.
Maybe the issue is in the jQuery name selector for some reason. Can I see the Form on the front-end of your site? Please provide a URL.
Please check the attached image.
Please check the attached
Thank you, I see your Forms screenshots but unfortunately they do not reveal anything obviously wrong in the JavaScript code snippet. I need to check this Form in the browser to understand why it is not working. This will allow me to use the browser's JavaScript debugging tools to figure out the problem. Please provide a URL where I can see the Form on your live site, or a URL to see the Form on a development testing site if you want me to help troubleshoot the custom code. All URLs you share in the forum are hidden from public view for your privacy and security.
I have activated private reply fields here so you can share a login if necessary. Thank you!
Please try to add the IP in the host file. I have updated the private reply to add the Host IP.
Unfortunately I am still unable to access the login with this IP and domain in my hosts file. I asked another supporter to test the login information as well. Shane added the IP to his host file and tested the login URL, but he had the same results. Neither of us can load the site, we get server timeout errors.
If it's too much trouble, we can try exporting your Types and Forms information using Toolset's Export tool, then try importing those structures in a sandbox site. If the problem is reproducible in a sandbox site, I will be able to investigate there.
Would you like to share your exported Types and Forms information instead?
Hi Christian,
I have export Forms, views, and Types. All are on this link. hidden link
I could share a copy of the website using the Duplicator plugin if needed.
Okay yes, I believe I need the Duplicator clone. I created a sandbox site and imported the Types and Forms content you shared. I placed the Update User Form on a new Page and tested it. I added some example text in the Rejection Reason field, then changed the "Please Register with other Organization" select field. As soon as I changed the select field, the contents of the Rejection Reason field were deleted. I made a screen recording for you:
https://drive.google.com/file/d/1j4xPdgcxh79ZYjHHC5ZbReGoG6JG07aO/view?usp=sharing
Something else must be going on, and I will need a site clone to be able to troubleshoot the problem. Please provide a download link here so I can access the Duplicator clone. Also, please let me know where to find the Update User Form on the front-end of the site. If I must follow some specific steps to access the Form, please provide step-by-step instructions.
Website copy on this link: hidden link
Kindly take all required details from the Previous private reply.
Thank you, I was able to download and install the site clone. When I log in as the User "test", I am able to test the Form at /sarh-profile. When I change the Organization field, the Rejection Reason field is cleared automatically. Have I misunderstood the problem? I have uploaded a screen recording here: https://drive.google.com/file/d/1YogQucLJcB7JFXFkfm_yaL3sVFbSJENf/view?usp=sharing
You can see the behavior is as described. The Rejection Reason field contents are cleared any time I change the select field. Am I missing something?
Strange!!! It is working with me now also. I don't know what is magic happened. I spent more than 2 weeks investigating the issue.
Many Thanks, Christian for your efforts.