Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    checkbox and form problem

    I have one form with one checkbox, source:
    {name: "mycheck",
    Id: "mycheck",
    title: "mycheck",
    type: "checkbox",
    valueMap:[0, 1],
    defaultValue: 1
    },

    then, I have one button with some js operations.
    everything goes fine, except each time I ask for the checkbox value, I get on e js error: object required

    the error fires in the following sentence:
    document.getElementById("mycheck").value
    what's wrong..?

    #2
    Use formId.getValue("mycheck").

    Don't go against the DOM directly. Firstly, SmartClient components aren't DOM elements, but JavaScript objects which generate a DOM as needed. A FormItem, for example, may exist, be tracking a value, and respond to various APIs, but not be drawn and have no DOM representation.

    Second, direct DOM access is where all cross-browser bugs come from. Still to SmartClient JavaScript APIs and you don't have to worry about those.

    Comment


      #3
      Oh also, it's "ID" not "Id".

      Comment

      Working...
      X