use ajax or leave form hidden?

Asked

Viewed 38 times

1

Good morning!

I am preparing a form, and this form contains a select field. Depending on the select field that the person chooses, new fields must be shown, exclusive to each option.

The question is: I must leave these fields previously loaded and leave them hidden (and obviously show as the option was selected), or I must make a new request with ajax and enter them the current page?

Or maybe they have a better alternative :)

Note that no database query will be made when choosing an option. I leave a picture below to illustrate better:

inserir a descrição da imagem aqui

Thank you!

  • Felipe, please post your code? It can be an example of one that will be visible and another that should be visible after selecting a certain option

  • 1

    This depends on your code, how it is loaded, whether it takes ajax calls...

  • I find it much better to keep it hidden than to make extra requests to the server. But I think the question is more based on opinion.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.