`onAfterRenderPage` fires only once
See original GitHub issueAre you requesting a feature, reporting a bug or ask a question?
It sounds like a bug, the docs says
The event is fired right after a page is rendred in DOM. Use it to modify html elements. There are two parameters in options: options.currentPage, options.htmlElement
it sounds like we can use to modify each page after it’s rendered. It also provides a currentPage
What is the current behavior?
onAfterRenderPage
is firing only once on page0
What is the expected behavior?
onAfterRenderPage
should fire on every page render
How would you reproduce the current behavior (if this is a bug)?
create a survey with multiple pages, add an onAfterRenderPage
handler and try it.
Provide the test code and the tested page URL (if applicable)
Tested page URL: https://plnkr.co/edit/5a1w1O5tJhdfKIwslYCo
Test code
Survey.Survey.cssType = "bootstrap";
Survey.defaultBootstrapCss.navigationButton = "btn btn-green";
window.survey = new Survey.Model({
"pages": [
{
"name": "page1",
"questions": [
{ "type": "text", "name": "satisfaction", "title": "How satisfied are you with the Product?" }
]
},
{
"name": "page2",
"questions": [
{ "type": "text", "name": "why", "title": "why?" }
]
}
]
});
survey.onComplete.add(function(result) {
document.querySelector('#surveyResult').innerHTML = "result: " + JSON.stringify(result.data);
});
survey.onAfterRenderPage .add(function(result, options) {
alert(options.page.name);
});
survey.data = {satisfaction: 'ok, i guess', why: 'because'};
$("#surveyElement").Survey({
model: survey
});
Specify your
- browser:
Chrome
- browser version:
61.0.3163.91
- surveyjs platform (angular or react or jquery or knockout or vue):
jquery
- surveyjs version:
0.12.23
Issue Analytics
- State:
- Created 6 years ago
- Comments:15 (7 by maintainers)
Top Results From Across the Web
event on page change - surveyjs Support
What fires first? onCurrentPageChanged or onAfterRenderPage ? Is there an event for when the survey state changes from "running" to "completed" ...
Read more >javascript - on change event fires only once - Stack Overflow
i'm trying to update cart whenever product quantity is changed. but jquery code is stop working after first time updating cart items. here...
Read more >SurveyModel | SurveyJS
onAfterRenderPage event. The event is fired right after a page is rendered in DOM. Use it to modify HTML elements. sender - the...
Read more >survey-knockout - UNPKG
2868, * Please note, it runs only one changing the expression result. ... 3524, * The event is fired before the survey is...
Read more >Why does my click event only fire once? - Codecademy Forums
What is driving me crazy is that it only fires ONCE - why can I not click it again to generate another random...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
ok so
onCurrentPageChanged
works on every page change, however it doesn’t fire for the initial page.workaround
use both,
onAfterRenderPage
which fires for page0, andonCurrentPageChanged
which fires for every page after that.Still
onAfterRenderPage
doesn’t fired when first page is rendered, I didn’t find any other event to use when Survey is loaded also.Tried a bunch of events
onStarted
,onAfterRenderPage
,onAfterRenderPanel
, etc… nothing is being fired at first load.