I've got a Search and Report datapage embedded on my web page. The search form has an autosubmit function, where if a parameter ([@DateF]) is present, it will 'autosearch'. If there is no parameter, it acts as a normal search form.
I am trying to find a way to reset the parameters using the standard link to search form. The 'Search Again' button that Caspio provides. I'm trying to use this one because my webpage is separated out by Roles, and multiple Roles use this same page. The URL for these roles are different, so I cannot just put a static href anchor tag. Hence why I am trying to use the standard feature, because this goes straight back to the search form in the same instance.
We've tried using this, where 'cbSearchAgain' acts as cbResetParam for search buttons (info from support), but my autosubmit function can still find the parameter after trying this out. In turn, I can never get to the search form.
document.addEventListener('DataPageReady', function (event) {
var searches = document.querySelectorAll("a[data-cb-name='SearchAgainButton']");
searches.forEach(function(search){
search.href = search.href.replace('cbSearchAgain=true', 'cbSearchAgain=false');
})
});
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Question
kpcollier
I've got a Search and Report datapage embedded on my web page. The search form has an autosubmit function, where if a parameter ([@DateF]) is present, it will 'autosearch'. If there is no parameter, it acts as a normal search form.
I am trying to find a way to reset the parameters using the standard link to search form. The 'Search Again' button that Caspio provides. I'm trying to use this one because my webpage is separated out by Roles, and multiple Roles use this same page. The URL for these roles are different, so I cannot just put a static href anchor tag. Hence why I am trying to use the standard feature, because this goes straight back to the search form in the same instance.
We've tried using this, where 'cbSearchAgain' acts as cbResetParam for search buttons (info from support), but my autosubmit function can still find the parameter after trying this out. In turn, I can never get to the search form.
document.addEventListener('DataPageReady', function (event) { var searches = document.querySelectorAll("a[data-cb-name='SearchAgainButton']"); searches.forEach(function(search){ search.href = search.href.replace('cbSearchAgain=true', 'cbSearchAgain=false'); }) });
Any ideas?
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.