mercredi 21 octobre 2015

mark the particular checkbox if condition is true using html

I am a newbie, and i need to mark a particular checkbox depending on query result

<c:forEach var="compnent" items="${compnents}">         
  <input type="checkbox" name="comp[]" value=${compnent}> ${compnent}
</c:forEach>

"compnents" - getting this value from controller class.It contains list of components which i am getting from a query

I will be using one more query to get list of components which are to be checked.

For Eg: with query1, i get the list of components which are say, comp1, comp2, comp3, comp4. So i get 4 checkboxes for each component. And all are not checked.

With query2, i get another list of components say, comp2, comp3. So comp2 and comp3 shd be marked and comp1 and comp4 shd not be marked.

FYI: I am using javascript and jquery to render the UI page

Could anyone please guide me?




Aucun commentaire:

Enregistrer un commentaire