Radio button not passing value Hi I m usiing this html template for booking selection https://codepen.io/creativetim/pen/EgVBXa
and my code is
@foreach($roomType as $roomTypes)
<div class="col-sm-3">
<div class="choice" data-toggle="wizard-radio" rel="tooltip">
<input type="radio" name="room_type_id"
value="{{ $roomTypes->id }}">
<div class="icon">
<i class="material-icons">weekend</i>
</div>
<h6>{{ $roomTypes->name }}</h6>
</div>
</div>
@endforeach
on dd () no value is present
array:8 [▼
"_token" => "HGNCTXiH9eTF1JpRkvP2NHKdAF7ECGjJs76EADxp"
"email" => "[email protected] "
"name" => "Zoran"
"country" => "Andorra"
"last_name" => "Bogoevski"
"start_date" => "2020-08-22"
"end_date" => "2020-08-23"
"submit" => "Зачувај"
]
bbut if I remove <div class="choice" data-toggle="wizard-radio" rel="tooltip"> it works
That is because of the data-toggle. It seems to override the primary click function of the element. In that case, the input is also never clicked.
You should probably add some javascript that sets the correct radio button based on the click of a class to make this work.
Also, note that the script you're using is 4 years old and not maintained anymore. You might have a new bootstrap and jQuery version and therefore this breaks: https://github.com/VinceG/twitter-bootstrap-wizard
@kalimeromk whats the js doing that is interacting on that .choose? is it rewriting the value?
it is not my choice to make I mast use it and this the js code of the data-toggle
$('[data-toggle="wizard-radio"]').click(function () {
wizard = $(this).closest('.wizard-card');
wizard.find('[data-toggle="wizard-radio"]').removeClass('active');
$(this).addClass('active');
$(wizard).find('[type="radio"]').removeAttr('checked');
$(this).find('[type="radio"]').attr('checked', 'true');
});
$('[data-toggle="wizard-checkbox"]').click(function () {
if ($(this).hasClass('active')) {
$(this).removeClass('active');
$(this).find('[type="checkbox"]').removeAttr('checked');
} else {
$(this).addClass('active');
$(this).find('[type="checkbox"]').attr('checked', 'true');
}
});
Are you sure that your radio button is part of the form?
With the form loaded in the browser, and the browser console open, what do you get if you type
$('[data-toggle="wizard-radio"]')
n.fn.init [div.choice.active, prevObject: n.fn.init(1), context: document, selector: "[data-toggle="wizard-radio"]"]0: div.choice.activecontext: documentlength: 1prevObject: n.fn.init [document, context: document]selector: "[data-toggle="wizard-radio"]"__proto__: Object(0)
Please sign in or create an account to participate in this conversation.