Skip Navigation

[Resolved] all JS codes not working suddenly.

This support ticket is created 2 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 17 replies, has 2 voices.

Last updated by salimA 2 years, 9 months ago.

Assisted by: Luo Yang.

Author
Posts
#2081425

Hi,

I have an issue that all JS codes in my toolset forms and views are not executed suddenly. Before it was working fine.

Could you please help me to figure out this issue?

For Example, This code in the view loop checks the availability of the user and redirects him to the suitable page. it was working but now it shows (No items found )

var myTableArray = [];

jQuery("table#empTable").each(function() {
var arrayOfThisRow = [];
var tableData = jQuery(this).find('td');
if (tableData.length > 0) {
tableData.each(function() { arrayOfThisRow.push(jQuery(this).text()); });
myTableArray.push(arrayOfThisRow);
}
});
var k=myTableArray.toString();
var id =document.querySelector('input[name="wpcf-hidden-id"]').value;
var n = k.includes(id);

if(n == true){
window.location.replace("hidden link..../login");
}
else{

window.location.replace("hidden link.../registration-form");
}

#2082225

Hello,

It is a custom JS codes problem.

Please check these:
1) Make sure you are using the latest version of Toolset plugins, you can download them here:
https://toolset.com/account/downloads/

2) Check if there is any JS errors in your website, if there is, then try to locate the problem JS codes, and fix them.

#2082361

Hi Yang,

thank you for your reply.

I have the latest version of Toolset and the latest version of WordPress. everything is updated. and I did patching for the server last week.

How can I check if there are errors in the JS on my website?

#2082363

Here is the document about "Javascript Debugging":
https://toolset.com/documentation/programmer-reference/debugging-sites-built-with-toolset/#javascript-debugging
section "Javascript Debugging"

#2089177
Capture.JPG

hi Yang

there is no error .. only warning.. check the attached image..

#2089259

Please provide a test site with the same problem, also point out the problem page URLs and where I can edit your custom JS codes, I need to test and debug it in a live website.

#2094277

Thanks for the details:
1) example of pages with JS
hidden link

Above page is displaying user view "Retrive Users IDs", please check it here:
hidden link
It is querying "Subscriber" users, but in your website, there isn't any "Subscriber" user, see the user list here:
hidden link
So it is expected result, you get the result: No items found

If you want query all users, you can edit the view "Retrive Users IDs", try option "Any role"

2) hidden link
JS in the form: Update User Form

I have tested it in frontend, your custom JS codes work just fine, but I recommend you wrap your custom JS codes with "cred_form_ready" JS event, I have done these:
hidden link
in section "JS editor", edit the JS codes as below:

jQuery(document).on('cred_form_ready', function(){
...
});
#2100367

Thank you for your reply.

1. It is querying "Subscriber" users, but on your website, there isn't any "Subscriber" user,
So it is expected result, you get the result: No items found

When there is no user the page should redirect me to Create User Page instead of showing 'No Items Found'

2. the JS code already wrapped inside "cred_form_ready".

#2100989

The JS codes you mentioned above is in user view:
hidden link

I have tried it again:
Open URL:
hidden link
It redirect me to another URL automatically:
hidden link

I don't see the problem you mentioned above:
all JS codes in my toolset forms and views are not executed suddenly
Is there any missing steps?

#2101055

Thank you Yang,

1. the first issue resolved. It works after I add one subscriber user.

2. But for the second issue, the code still not working properly, the rejection-reason field does not empty after changing the Org although the request status field changed to pending.

So part of the code works and the second part no.

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( 'select[name="wpcf-org"]' ).change(function() {
jQuery( 'input[name="wpcf-rejection-reason"]' ).val(" ");
});

});

#2101085
pending.JPG

I assume we are talking about the user form "Update User Form"
hidden link

And in the problem page:
hidden link
I don't see above user form.

So I have tried these in your website:
Create a new page:
hidden link
Display the editing user form "Update User Form" shortcode:
[cred_user_form form="update-user-form"]

Test it in front-end:
hidden link
Change option in the dropdown menu "Please Register with other Organization" , it works fine, see my screenshot: pending.JPG

Can you confirm it?

#2101167
2.JPG
1.JPG

Thank you for your replay Yang,

In the image 1, the status is rejected and the rejection reason is test.
what we expect:
when the user changes the org. the status should be changed from rejected to pending and the rejection reason should be empty.
what we got:
the request status changed to pending but the rejection reason value does not become empty as on image 2.

#2101987

I have done below modifications in your website:
Edit the user form:
hidden link
in section "Form Editor", change line 33 from:

<b>

To:

<b class="wpcf-request-status">

Please test again, check if it is fixed, thanks

#2102089

I have tried, Unfortunately, still the rejection reason value does not become empty.

#2102759

It is your custom JS problem, I have setup a demo in your website, edit above user form:
1) In "Form Editor", Change line 43 to:

<b class="wpcf-rejection-reason">[types usermeta='rejection-reason' current_user='true'][/types]</b>

2) change the JS codes lines 8 to:

    	jQuery( 'b.wpcf-rejection-reason' ).text("");
});
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.