question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Radiogroup widget afterRender code undone on value change

See original GitHub issue

In order to restyle a radio button I added an extra span after it, in the otherwise default Bootstrap structure. This lets me style the radio button with input + span and input:checked + span without using any extra JavaScript to rebuild the default behavior.

To add this extra span in Survey JS I used the widget approach, targeting all radiogroups:

var widget = {
	name: 'radiogroup-styling',
	isFit: function (question) {
		return question.getType() === 'radiogroup';
	},
	isDefaultRender: true,
	afterRender: function(question, el) {
		$(el).find('input').after('<span/>');
	}
};

This works like a charm, until you click a radio button/change the value. Then the extra span disappears and only the original Survey JS DOM structure remains. I have created a CodePen to show the issue: http://codepen.io/Wimski/pen/YVzzZW

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dmitrykurmanovcommented, Apr 13, 2017

@WimWidgets we’ve released v.0.12.8. It is works now. Example pen: http://codepen.io/anon/pen/xdxBdo

1reaction
dmitrykurmanovcommented, Apr 12, 2017

@WimWidgets hello! This is a bug. We fixed it in 2b8b28ab932a3c0901977247fbad428d861cc2fc. Thanks, as a workaround you can use isDefaultRender: false and render your markup.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Radiogroup widget afterRender code undone on value change
@WimWidgets hello! This is a bug. We fixed it in 2b8b28a. Thanks, as a workaround you can use isDefaultRender: false and render your...
Read more >
Ext.form.RadioGroup | Ext JS 6.2.0 - Sencha Documentation
Specifies the number of columns to use when displaying grouped checkbox/radio controls using automatic layout. This config can take several types of values:....
Read more >
Handle the Value Change Event - DevExtreme - DevExpress
To process a new RadioGroup value, you need to handle the value change event. ... assign it to the onValueChanged option when you...
Read more >
How to use custom checked or ticked event of radiogroup in ...
Anyone can tell me how can we use custom checked event or any other event so we will call the change event only...
Read more >
updateRadioGroupButtons: Change the value of a radio group ...
The session object passed to function given to shinyServer . Default is getDefaultReactiveDomain() . inputId. The id of the input object.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found