select max two options in a checkbox in a XML PHP application

Viewed 19

We have an application developed with PHP, XML and JS.

Can i limit the number of selection in a checkbox to two at max? In a sort that an alert is shown in the third selection

This is the XML code :

        <bloc >
  <nom>RECOMMANDATION</nom>
  <questions>
    <question type="5">
          <code_question>318</code_question>
          <label>Your choice ?</label>
          <reponses>
            <reponse>
              <code_reponse>911</code_reponse>
              <label_reponse>choice 1</label_reponse>
            </reponse>
      <reponse>
              <code_reponse>912</code_reponse>
              <label_reponse>Choice 2</label_reponse>
            </reponse>
            <reponse>
              <code_reponse>913</code_reponse>
              <label_reponse>Choice 3</label_reponse>
            </reponse>
      </reponses>
    </question>
  </questions>
</bloc>

For your information : The attribute "type" is the type of the select (Checkbox, radio ...) developped with JS.

Thanks.

0 Answers
Related