Level 63
Hello @nihalarya,
Yes it's possible. I do this using javascipt.
You have your view.
<select id="restaurant_id" name="restaurant_id">...</select>
<div id="other_fields"></div>
Then in your javascript / jquery code, you have to add an event on the select change.
$("#restaurant_id").on("change", function() {
var restaurant_id = $("#restaurant_id").val();
// According to the restaurant_id, you decide here what to display
// If you have to retrieve some data from the database, you can try a get or post ajax
$.post(
url: URL, // URL according to your routes, the data are sent by the controller
{
restaurant_id: restaurant_id,
other_data: OTHER_DATA, // other data if you need
},
)
.done(function(data) { // data sent by the controller
$("#other_fields").html(data);
})
.fail(function() {
alert("An error has occured !");
});
});
Tell me how it works ...