Results 1 to 4 of 4

Thread: Checkbox canīt be unchecked on custom module

  1. #1
    madhutirumalasetti is offline Junior Member
    Join Date
    Oct 2010
    Posts
    1

    Default Checkbox canīt be unchecked on custom module

    Hi everybody...

    i am new to sugarcrm .

    I'm having a problem with a custom module that has some checkbox fields. It saves me right if check them as true, but when i set them unchecked they do not update and the value do not changes.

    this the code.


    array (
    'name' => 'approved',
    'label' => 'LBL_APPROVED',
    'customCode' => '<input name="approved" {if ($current_user->is_admin.value != 1)}disabled="disabled"{/if} type="checkbox" {if ($fields.approved.value == 1)}checked="checked"{/if} value="{$fields.approved.value}" />',
    )

    Hope you can help me... thanks in advance.

  2. #2
    rcanepa is offline Senior Member
    Join Date
    Oct 2010
    Location
    Chile
    Posts
    22

    Default Re: Checkbox canīt be unchecked on custom module

    Same problem here... Anyone can help us?

  3. #3
    davidboris is offline Sugar Community Member
    Join Date
    May 2010
    Posts
    1,113

    Default Re: Checkbox canīt be unchecked on custom module

    Hello,

    Replace your code from

    PHP Code:
    'customCode' => '<input name="approved" {if ($current_user->is_admin.value != 1)}disabled="disabled"{/if} type="checkbox" {if ($fields.approved.value == 1)}checked="checked"{/if} value="{$fields.approved.value}" />'
    to

    PHP Code:
    'customCode' => '<input type="hidden" value="0" name="approved" {if ($current_user->is_admin.value != 1)}disabled="disabled"{/if} /> <input id="approved" name="approved" {if ($current_user->is_admin.value != 1)}disabled="disabled"{/if} type="checkbox" {if ($fields.approved.value == 1)}checked="checked"{/if} value="1" />'
    Thumbs up.

    Skype ID - david__boris

    SugarForge Projects:

    WYSIWYG now in studio!(Version 1.1 is out now!)

    Sugar Feeds on your personalized home pages like iGoogle, My Yahoo!, etc.

    Fab Tools! > Dashlet Not Followed Opportunities for past six Months

  4. #4
    rcanepa is offline Senior Member
    Join Date
    Oct 2010
    Location
    Chile
    Posts
    22

    Default Re: Checkbox canīt be unchecked on custom module

    Quote Originally Posted by davidboris View Post
    Hello,

    Replace your code from

    PHP Code:
    'customCode' => '<input name="approved" {if ($current_user->is_admin.value != 1)}disabled="disabled"{/if} type="checkbox" {if ($fields.approved.value == 1)}checked="checked"{/if} value="{$fields.approved.value}" />'
    to

    PHP Code:
    'customCode' => '<input type="hidden" value="0" name="approved" {if ($current_user->is_admin.value != 1)}disabled="disabled"{/if} /> <input id="approved" name="approved" {if ($current_user->is_admin.value != 1)}disabled="disabled"{/if} type="checkbox" {if ($fields.approved.value == 1)}checked="checked"{/if} value="1" />'
    It worked perfect, thx u davidboris!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 2
    Last Post: 2010-01-29, 12:53 PM
  2. Replies: 3
    Last Post: 2010-01-24, 10:05 AM
  3. Searching for unchecked checkbox.
    By mrmmm in forum Help
    Replies: 11
    Last Post: 2009-05-18, 02:26 PM
  4. Checkbox canīt be unchecked on custom module...
    By jasv in forum Developer Help
    Replies: 2
    Last Post: 2009-02-11, 11:50 AM
  5. Replies: 1
    Last Post: 2008-12-18, 02:49 PM

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
  •