Results 1 to 4 of 4

Thread: Undefined checkbox

  1. #1
    mcharudatta is offline Sugar Community Member
    Join Date
    Mar 2006
    Posts
    17

    Default Undefined checkbox

    Hello,

    I want help about Contact module in SugarCRM open source (4.5.1e). In the EditView, I have added 4 custom fields of type checkbox. Say check1, check2, check3, check4.
    Now I want to add an event to the first checkbox check1, such as when the user select the first checkbox, all the other checkboxes should be disabled. and if the user clears the first check box, then all the other checkboxes should be enabled back.

    I added onblur="return updateCheck(EditView)" attribute to the check1 checkbox item. I have also added the javascript function (updateCheck(EditView)) in the same EditView file. In the javascript function, initially I am checking whether the check box is selected or clear. But, when I open the EditView in the browser and click on the first check box I got an error message as the check box is undefined.

    Please let me know if I am doing this correctly.

    Thanks
    Charudatta

  2. #2
    SamuelAugy is offline Sugar Community Member
    Join Date
    Sep 2007
    Location
    Paris (France)
    Posts
    238

    Default Re: Undefined checkbox

    I think you can use onClick but it's the good solution. You don't need to to use the EditView parameter in you function neither the return : just call the function. And in this function, you can use this syntax : domcument.EditView.check1.XXXX

    Samuel Augy

  3. #3
    mcharudatta is offline Sugar Community Member
    Join Date
    Mar 2006
    Posts
    17

    Default Re: Undefined checkbox

    Hi Samuel,

    Thanks for your reply. As per the information I updated the Contacts > EditView.html file. But, I am still getting the same error as "Checkbox undefined". I am adding the code here. please let me know if I am doing correctly.

    <!-- Check Box Item -->
    <td class="dataLabel" colspan="1"><span sugar='slot42'>{MOD.contact_education_non_matric_c }</span sugar='slot'></td>
    <td class="dataField" colspan="1"><span sugar='slot42b'><input type='hidden' name='contact_education_non_matric_c' value='0'><input type='checkbox' name='contact_education_non_matric_c' id='contact_education_non_matric_c' title='{CONTACT_EDUCATION_NON_MATRIC_C_HELP}' value='1'
    onclick="checkEducation()" {CONTACT_EDUCATION_NON_MATRIC_C_CHECKED}></span sugar='slot'></td>

    <!-- JavaScript for the above Check Box -->
    function checkEducation () {
    if (document.EditView.contact_education_non_matric_c) {
    alert ("Check Box value: " + document.EditView.contact_education_non_matric_c.c hecked);
    document.EditView.contact_education_ssc_c.value=fa lse;
    }
    }

    <!-- Error Message -->

    The checkbox is undefined

    Thnaks
    Charudatta

  4. #4
    SamuelAugy is offline Sugar Community Member
    Join Date
    Sep 2007
    Location
    Paris (France)
    Posts
    238

    Default Re: Undefined checkbox

    In this case I think you must use this synthax : document.getElementById('contact_education_non_mat ric_c').checked =false; because you have 2 input with the same name and the same for your if.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Admin Tools for SugarCRM 4.2
    By kbrill in forum Downloads
    Replies: 80
    Last Post: 2006-09-22, 10:31 PM
  2. PHP Warnings after install add-in Module
    By kgeving in forum Help
    Replies: 1
    Last Post: 2006-08-08, 05:54 PM
  3. Errors after upgrade
    By mturany in forum Help
    Replies: 0
    Last Post: 2006-04-24, 04:40 AM
  4. ERROR in 4.01
    By rateck in forum Help
    Replies: 3
    Last Post: 2006-02-02, 10:00 PM
  5. Replies: 7
    Last Post: 2005-05-10, 08:25 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •