Announcement

Collapse
No announcement yet.

[SOLVED] Checkbox: If yes selected then no un-selected and vice versa

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • [SOLVED] Checkbox: If yes selected then no un-selected and vice versa

    I have a field with manual select checkbox. Y = 1, N = 0. I want to change the behavior of the checkbox. If yes is selected then obviously no can't be selected too. However, the nature of check boxes in SC allows this. What I need is if I click the yes and then the no the yes unchecks and vice versa. I've tried this javascript but it seems to be malformed.

    Code:
    var checkboxes = document.querySelectorAll('input[type=checkbox]');
    if (checkboxes[0].checked = true;)
    	{
    	checkboxes[1].checked = false;
    	}
    elseif (checkboxes[1].checked = true;)
    	{
    	checkboxes[0].checked = false;
    	}

  • #2
    Hi,
    it sounds what you are trying to do is to mimic a radio/options button.
    So why don't you just have a look at the field type 'Radio' and see if you can get the result you want.

    Later on
    jsb

    Comment


    • #3
      Thanks, can't believe I didn't think of that. Don't use radio button that often and forgot about them. sorry for wasting forum space

      I have a tendency to over think things sometimes.

      Comment

      Working...
      X