Another checkbox manipulation question

Discussion in 'ASP General' started by Jack, Feb 25, 2005.

  1. Jack

    Jack Guest

    <i><input type="checkbox" name="chk_Complete" value="TRUE" <%Response.Write
    l_IsChecked%>"<%if cbool(l_IsChecked) then Response.Write " checked" Else
    Response.Write " unchecked"%>>

    The above code shows a checkbox on a asp form where the checkbox value is
    stored and retrived from a field in an
    Access database.

    When the checkbox is unchecked, for some reason, the value of checkbox shows
    null value instead of showing False
    (This is the sql processing and database update asp page)

    I would like to force this value to be false in the event the
    (Request.Form("chk_Complete") value is null.

    The following is the code to force False value in the above field. However,
    the value is stil null. Any
    help is appreciated. The variable output and the sql generated for unchecked
    and checked cases are also shown.




    if CBool(Request.Form("chk_Complete")) = "" Then
    Cbool(Request.Form("chk_Complete")) = "False"
    end if
    l_f_IsChecked = (Request.Form("chk_Complete"))
    CASE: CHECKBOX UNCHECKED

    START CHECK COMPLETE

    THE END
    StartCheckBox

    EndCheckbox

    UPDATE tblGMISExpenditures_Quarter SET
    tblGMISExpenditures_Quarter.CurrentOutlay= '$550.00' ,
    tblGMISExpenditures_Quarter.LocalShare= '$100.50' ,
    tblGMISExpenditures_Quarter.MBCCShare= '449.5' ,
    tblGMISExpenditures_Quarter.UnpaidOblig= '$250.00' ,
    tblGMISExpenditures_Quarter.LocalShareUnpaidOblig= '$35.35' ,
    tblGMISExpenditures_Quarter.ProjectIncome= '$100.00' ,
    tblGMISExpenditures_Quarter.ForfeitureIncome= '$200.00' ,
    tblGMISExpenditures_Quarter.OtherExpense= '$30.00' ,
    tblGMISExpenditures_Quarter.ForfeitureExpense= '$40.00' ,
    tblGMISExpenditures_Quarter.InterestReceived= '$20.00' ,
    tblGMISExpenditures_Quarter.TotalPeriodOutlay= '4568.39' ,
    tblGMISExpenditures_Quarter.Remarks= 'Testing GWIS' ,
    tblGMISExpenditures_Quarter.Name= 'Jack Jones' ,
    tblGMISExpenditures_Quarter.Title= 'Manager' ,
    tblGMISExpenditures_Quarter.AreaCode= '111' ,
    tblGMISExpenditures_Quarter.Phone1= '111' ,
    tblGMISExpenditures_Quarter.Phone2= '8762' ,
    tblGMISExpenditures_Quarter.Date= '1/11/2005' ,
    tblGMISExpenditures_Quarter.IsChecked= where
    tblGMISExpenditures_Quarter.SubgrantIntID = 4836;

    CASE: CHECK BOX CHECKED

    START CHECK COMPLETE
    TRUE
    THE END
    StartCheckBox
    TRUE
    EndCheckbox

    UPDATE tblGMISExpenditures_Quarter SET
    tblGMISExpenditures_Quarter.CurrentOutlay= '$550.00' ,
    tblGMISExpenditures_Quarter.LocalShare= '$100.50' ,
    tblGMISExpenditures_Quarter.MBCCShare= '449.5' ,
    tblGMISExpenditures_Quarter.UnpaidOblig= '$250.00' ,
    tblGMISExpenditures_Quarter.LocalShareUnpaidOblig= '$35.35' ,
    tblGMISExpenditures_Quarter.ProjectIncome= '$100.00' ,
    tblGMISExpenditures_Quarter.ForfeitureIncome= '$200.00' ,
    tblGMISExpenditures_Quarter.OtherExpense= '$30.00' ,
    tblGMISExpenditures_Quarter.ForfeitureExpense= '$40.00' ,
    tblGMISExpenditures_Quarter.InterestReceived= '$20.00' ,
    tblGMISExpenditures_Quarter.TotalPeriodOutlay= '4568.39' ,
    tblGMISExpenditures_Quarter.Remarks= 'Testing GWIS' ,
    tblGMISExpenditures_Quarter.Name= 'Jack Jones' ,
    tblGMISExpenditures_Quarter.Title= 'Manager' ,
    tblGMISExpenditures_Quarter.AreaCode= '111' ,
    tblGMISExpenditures_Quarter.Phone1= '111' ,
    tblGMISExpenditures_Quarter.Phone2= '8762' ,
    tblGMISExpenditures_Quarter.Date= '1/11/2005' ,
    tblGMISExpenditures_Quarter.IsChecked= TRUE where
    tblGMISExpenditures_Quarter.SubgrantIntID = 4836;
    Jack, Feb 25, 2005
    #1
    1. Advertising

  2. Jack

    Mark Schupp Guest

    When the checkbox is unchecked the value is not sent in the form.
    Try something like this;

    <input type="checkbox" name="chk_Complete" value="TRUE"
    <%if cbool(l_IsChecked) then Response.Write " checked" %>>

    and

    If Trim(Request.Form("chk_Complete")) = "TRUE" Then
    l_f_IsChecked = "TRUE"
    Else
    l_f_IsChecked = "FALSE"
    End If

    I'd also suggest using boolean values instead of tossing CBool in
    everywhere.

    <input type="checkbox" name="chk_Complete" value="TRUE"
    <%if l_IsChecked then Response.Write " checked" %>>

    and

    If Trim(Request.Form("chk_Complete")) = "TRUE" Then
    l_f_IsChecked = True
    Else
    l_f_IsChecked = True
    End If

    --
    Mark Schupp
    Head of Development
    Integrity eLearning
    www.ielearning.com


    "Jack" <> wrote in message
    news:...
    > <i><input type="checkbox" name="chk_Complete" value="TRUE"

    <%Response.Write
    > l_IsChecked%>"<%if cbool(l_IsChecked) then Response.Write " checked" Else
    > Response.Write " unchecked"%>>
    >
    > The above code shows a checkbox on a asp form where the checkbox value is
    > stored and retrived from a field in an
    > Access database.
    >
    > When the checkbox is unchecked, for some reason, the value of checkbox

    shows
    > null value instead of showing False
    > (This is the sql processing and database update asp page)
    >
    > I would like to force this value to be false in the event the
    > (Request.Form("chk_Complete") value is null.
    >
    > The following is the code to force False value in the above field.

    However,
    > the value is stil null. Any
    > help is appreciated. The variable output and the sql generated for

    unchecked
    > and checked cases are also shown.
    >
    >
    >
    >
    > if CBool(Request.Form("chk_Complete")) = "" Then
    > Cbool(Request.Form("chk_Complete")) = "False"
    > end if
    > l_f_IsChecked = (Request.Form("chk_Complete"))
    > CASE: CHECKBOX UNCHECKED
    >
    > START CHECK COMPLETE
    >
    > THE END
    > StartCheckBox
    >
    > EndCheckbox
    >
    > UPDATE tblGMISExpenditures_Quarter SET
    > tblGMISExpenditures_Quarter.CurrentOutlay= '$550.00' ,
    > tblGMISExpenditures_Quarter.LocalShare= '$100.50' ,
    > tblGMISExpenditures_Quarter.MBCCShare= '449.5' ,
    > tblGMISExpenditures_Quarter.UnpaidOblig= '$250.00' ,
    > tblGMISExpenditures_Quarter.LocalShareUnpaidOblig= '$35.35' ,
    > tblGMISExpenditures_Quarter.ProjectIncome= '$100.00' ,
    > tblGMISExpenditures_Quarter.ForfeitureIncome= '$200.00' ,
    > tblGMISExpenditures_Quarter.OtherExpense= '$30.00' ,
    > tblGMISExpenditures_Quarter.ForfeitureExpense= '$40.00' ,
    > tblGMISExpenditures_Quarter.InterestReceived= '$20.00' ,
    > tblGMISExpenditures_Quarter.TotalPeriodOutlay= '4568.39' ,
    > tblGMISExpenditures_Quarter.Remarks= 'Testing GWIS' ,
    > tblGMISExpenditures_Quarter.Name= 'Jack Jones' ,
    > tblGMISExpenditures_Quarter.Title= 'Manager' ,
    > tblGMISExpenditures_Quarter.AreaCode= '111' ,
    > tblGMISExpenditures_Quarter.Phone1= '111' ,
    > tblGMISExpenditures_Quarter.Phone2= '8762' ,
    > tblGMISExpenditures_Quarter.Date= '1/11/2005' ,
    > tblGMISExpenditures_Quarter.IsChecked= where
    > tblGMISExpenditures_Quarter.SubgrantIntID = 4836;
    >
    > CASE: CHECK BOX CHECKED
    >
    > START CHECK COMPLETE
    > TRUE
    > THE END
    > StartCheckBox
    > TRUE
    > EndCheckbox
    >
    > UPDATE tblGMISExpenditures_Quarter SET
    > tblGMISExpenditures_Quarter.CurrentOutlay= '$550.00' ,
    > tblGMISExpenditures_Quarter.LocalShare= '$100.50' ,
    > tblGMISExpenditures_Quarter.MBCCShare= '449.5' ,
    > tblGMISExpenditures_Quarter.UnpaidOblig= '$250.00' ,
    > tblGMISExpenditures_Quarter.LocalShareUnpaidOblig= '$35.35' ,
    > tblGMISExpenditures_Quarter.ProjectIncome= '$100.00' ,
    > tblGMISExpenditures_Quarter.ForfeitureIncome= '$200.00' ,
    > tblGMISExpenditures_Quarter.OtherExpense= '$30.00' ,
    > tblGMISExpenditures_Quarter.ForfeitureExpense= '$40.00' ,
    > tblGMISExpenditures_Quarter.InterestReceived= '$20.00' ,
    > tblGMISExpenditures_Quarter.TotalPeriodOutlay= '4568.39' ,
    > tblGMISExpenditures_Quarter.Remarks= 'Testing GWIS' ,
    > tblGMISExpenditures_Quarter.Name= 'Jack Jones' ,
    > tblGMISExpenditures_Quarter.Title= 'Manager' ,
    > tblGMISExpenditures_Quarter.AreaCode= '111' ,
    > tblGMISExpenditures_Quarter.Phone1= '111' ,
    > tblGMISExpenditures_Quarter.Phone2= '8762' ,
    > tblGMISExpenditures_Quarter.Date= '1/11/2005' ,
    > tblGMISExpenditures_Quarter.IsChecked= TRUE where
    > tblGMISExpenditures_Quarter.SubgrantIntID = 4836;
    Mark Schupp, Feb 25, 2005
    #2
    1. Advertising

  3. Jack

    Jack Guest

    I got help from Bob Barrows in an earlier posting about the checkbox and it
    solved the problem. Thanks anyways.

    "Jack" wrote:

    > <i><input type="checkbox" name="chk_Complete" value="TRUE" <%Response.Write
    > l_IsChecked%>"<%if cbool(l_IsChecked) then Response.Write " checked" Else
    > Response.Write " unchecked"%>>
    >
    > The above code shows a checkbox on a asp form where the checkbox value is
    > stored and retrived from a field in an
    > Access database.
    >
    > When the checkbox is unchecked, for some reason, the value of checkbox shows
    > null value instead of showing False
    > (This is the sql processing and database update asp page)
    >
    > I would like to force this value to be false in the event the
    > (Request.Form("chk_Complete") value is null.
    >
    > The following is the code to force False value in the above field. However,
    > the value is stil null. Any
    > help is appreciated. The variable output and the sql generated for unchecked
    > and checked cases are also shown.
    >
    >
    >
    >
    > if CBool(Request.Form("chk_Complete")) = "" Then
    > Cbool(Request.Form("chk_Complete")) = "False"
    > end if
    > l_f_IsChecked = (Request.Form("chk_Complete"))
    > CASE: CHECKBOX UNCHECKED
    >
    > START CHECK COMPLETE
    >
    > THE END
    > StartCheckBox
    >
    > EndCheckbox
    >
    > UPDATE tblGMISExpenditures_Quarter SET
    > tblGMISExpenditures_Quarter.CurrentOutlay= '$550.00' ,
    > tblGMISExpenditures_Quarter.LocalShare= '$100.50' ,
    > tblGMISExpenditures_Quarter.MBCCShare= '449.5' ,
    > tblGMISExpenditures_Quarter.UnpaidOblig= '$250.00' ,
    > tblGMISExpenditures_Quarter.LocalShareUnpaidOblig= '$35.35' ,
    > tblGMISExpenditures_Quarter.ProjectIncome= '$100.00' ,
    > tblGMISExpenditures_Quarter.ForfeitureIncome= '$200.00' ,
    > tblGMISExpenditures_Quarter.OtherExpense= '$30.00' ,
    > tblGMISExpenditures_Quarter.ForfeitureExpense= '$40.00' ,
    > tblGMISExpenditures_Quarter.InterestReceived= '$20.00' ,
    > tblGMISExpenditures_Quarter.TotalPeriodOutlay= '4568.39' ,
    > tblGMISExpenditures_Quarter.Remarks= 'Testing GWIS' ,
    > tblGMISExpenditures_Quarter.Name= 'Jack Jones' ,
    > tblGMISExpenditures_Quarter.Title= 'Manager' ,
    > tblGMISExpenditures_Quarter.AreaCode= '111' ,
    > tblGMISExpenditures_Quarter.Phone1= '111' ,
    > tblGMISExpenditures_Quarter.Phone2= '8762' ,
    > tblGMISExpenditures_Quarter.Date= '1/11/2005' ,
    > tblGMISExpenditures_Quarter.IsChecked= where
    > tblGMISExpenditures_Quarter.SubgrantIntID = 4836;
    >
    > CASE: CHECK BOX CHECKED
    >
    > START CHECK COMPLETE
    > TRUE
    > THE END
    > StartCheckBox
    > TRUE
    > EndCheckbox
    >
    > UPDATE tblGMISExpenditures_Quarter SET
    > tblGMISExpenditures_Quarter.CurrentOutlay= '$550.00' ,
    > tblGMISExpenditures_Quarter.LocalShare= '$100.50' ,
    > tblGMISExpenditures_Quarter.MBCCShare= '449.5' ,
    > tblGMISExpenditures_Quarter.UnpaidOblig= '$250.00' ,
    > tblGMISExpenditures_Quarter.LocalShareUnpaidOblig= '$35.35' ,
    > tblGMISExpenditures_Quarter.ProjectIncome= '$100.00' ,
    > tblGMISExpenditures_Quarter.ForfeitureIncome= '$200.00' ,
    > tblGMISExpenditures_Quarter.OtherExpense= '$30.00' ,
    > tblGMISExpenditures_Quarter.ForfeitureExpense= '$40.00' ,
    > tblGMISExpenditures_Quarter.InterestReceived= '$20.00' ,
    > tblGMISExpenditures_Quarter.TotalPeriodOutlay= '4568.39' ,
    > tblGMISExpenditures_Quarter.Remarks= 'Testing GWIS' ,
    > tblGMISExpenditures_Quarter.Name= 'Jack Jones' ,
    > tblGMISExpenditures_Quarter.Title= 'Manager' ,
    > tblGMISExpenditures_Quarter.AreaCode= '111' ,
    > tblGMISExpenditures_Quarter.Phone1= '111' ,
    > tblGMISExpenditures_Quarter.Phone2= '8762' ,
    > tblGMISExpenditures_Quarter.Date= '1/11/2005' ,
    > tblGMISExpenditures_Quarter.IsChecked= TRUE where
    > tblGMISExpenditures_Quarter.SubgrantIntID = 4836;
    Jack, Feb 25, 2005
    #3
  4. Jack

    Jack Guest

    Thanks Mark for your help. I have already got it solved. However, I am going
    to try it the way you suggested. Regards.

    "Mark Schupp" wrote:

    > When the checkbox is unchecked the value is not sent in the form.
    > Try something like this;
    >
    > <input type="checkbox" name="chk_Complete" value="TRUE"
    > <%if cbool(l_IsChecked) then Response.Write " checked" %>>
    >
    > and
    >
    > If Trim(Request.Form("chk_Complete")) = "TRUE" Then
    > l_f_IsChecked = "TRUE"
    > Else
    > l_f_IsChecked = "FALSE"
    > End If
    >
    > I'd also suggest using boolean values instead of tossing CBool in
    > everywhere.
    >
    > <input type="checkbox" name="chk_Complete" value="TRUE"
    > <%if l_IsChecked then Response.Write " checked" %>>
    >
    > and
    >
    > If Trim(Request.Form("chk_Complete")) = "TRUE" Then
    > l_f_IsChecked = True
    > Else
    > l_f_IsChecked = True
    > End If
    >
    > --
    > Mark Schupp
    > Head of Development
    > Integrity eLearning
    > www.ielearning.com
    >
    >
    > "Jack" <> wrote in message
    > news:...
    > > <i><input type="checkbox" name="chk_Complete" value="TRUE"

    > <%Response.Write
    > > l_IsChecked%>"<%if cbool(l_IsChecked) then Response.Write " checked" Else
    > > Response.Write " unchecked"%>>
    > >
    > > The above code shows a checkbox on a asp form where the checkbox value is
    > > stored and retrived from a field in an
    > > Access database.
    > >
    > > When the checkbox is unchecked, for some reason, the value of checkbox

    > shows
    > > null value instead of showing False
    > > (This is the sql processing and database update asp page)
    > >
    > > I would like to force this value to be false in the event the
    > > (Request.Form("chk_Complete") value is null.
    > >
    > > The following is the code to force False value in the above field.

    > However,
    > > the value is stil null. Any
    > > help is appreciated. The variable output and the sql generated for

    > unchecked
    > > and checked cases are also shown.
    > >
    > >
    > >
    > >
    > > if CBool(Request.Form("chk_Complete")) = "" Then
    > > Cbool(Request.Form("chk_Complete")) = "False"
    > > end if
    > > l_f_IsChecked = (Request.Form("chk_Complete"))
    > > CASE: CHECKBOX UNCHECKED
    > >
    > > START CHECK COMPLETE
    > >
    > > THE END
    > > StartCheckBox
    > >
    > > EndCheckbox
    > >
    > > UPDATE tblGMISExpenditures_Quarter SET
    > > tblGMISExpenditures_Quarter.CurrentOutlay= '$550.00' ,
    > > tblGMISExpenditures_Quarter.LocalShare= '$100.50' ,
    > > tblGMISExpenditures_Quarter.MBCCShare= '449.5' ,
    > > tblGMISExpenditures_Quarter.UnpaidOblig= '$250.00' ,
    > > tblGMISExpenditures_Quarter.LocalShareUnpaidOblig= '$35.35' ,
    > > tblGMISExpenditures_Quarter.ProjectIncome= '$100.00' ,
    > > tblGMISExpenditures_Quarter.ForfeitureIncome= '$200.00' ,
    > > tblGMISExpenditures_Quarter.OtherExpense= '$30.00' ,
    > > tblGMISExpenditures_Quarter.ForfeitureExpense= '$40.00' ,
    > > tblGMISExpenditures_Quarter.InterestReceived= '$20.00' ,
    > > tblGMISExpenditures_Quarter.TotalPeriodOutlay= '4568.39' ,
    > > tblGMISExpenditures_Quarter.Remarks= 'Testing GWIS' ,
    > > tblGMISExpenditures_Quarter.Name= 'Jack Jones' ,
    > > tblGMISExpenditures_Quarter.Title= 'Manager' ,
    > > tblGMISExpenditures_Quarter.AreaCode= '111' ,
    > > tblGMISExpenditures_Quarter.Phone1= '111' ,
    > > tblGMISExpenditures_Quarter.Phone2= '8762' ,
    > > tblGMISExpenditures_Quarter.Date= '1/11/2005' ,
    > > tblGMISExpenditures_Quarter.IsChecked= where
    > > tblGMISExpenditures_Quarter.SubgrantIntID = 4836;
    > >
    > > CASE: CHECK BOX CHECKED
    > >
    > > START CHECK COMPLETE
    > > TRUE
    > > THE END
    > > StartCheckBox
    > > TRUE
    > > EndCheckbox
    > >
    > > UPDATE tblGMISExpenditures_Quarter SET
    > > tblGMISExpenditures_Quarter.CurrentOutlay= '$550.00' ,
    > > tblGMISExpenditures_Quarter.LocalShare= '$100.50' ,
    > > tblGMISExpenditures_Quarter.MBCCShare= '449.5' ,
    > > tblGMISExpenditures_Quarter.UnpaidOblig= '$250.00' ,
    > > tblGMISExpenditures_Quarter.LocalShareUnpaidOblig= '$35.35' ,
    > > tblGMISExpenditures_Quarter.ProjectIncome= '$100.00' ,
    > > tblGMISExpenditures_Quarter.ForfeitureIncome= '$200.00' ,
    > > tblGMISExpenditures_Quarter.OtherExpense= '$30.00' ,
    > > tblGMISExpenditures_Quarter.ForfeitureExpense= '$40.00' ,
    > > tblGMISExpenditures_Quarter.InterestReceived= '$20.00' ,
    > > tblGMISExpenditures_Quarter.TotalPeriodOutlay= '4568.39' ,
    > > tblGMISExpenditures_Quarter.Remarks= 'Testing GWIS' ,
    > > tblGMISExpenditures_Quarter.Name= 'Jack Jones' ,
    > > tblGMISExpenditures_Quarter.Title= 'Manager' ,
    > > tblGMISExpenditures_Quarter.AreaCode= '111' ,
    > > tblGMISExpenditures_Quarter.Phone1= '111' ,
    > > tblGMISExpenditures_Quarter.Phone2= '8762' ,
    > > tblGMISExpenditures_Quarter.Date= '1/11/2005' ,
    > > tblGMISExpenditures_Quarter.IsChecked= TRUE where
    > > tblGMISExpenditures_Quarter.SubgrantIntID = 4836;

    >
    >
    >
    Jack, Feb 25, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. tshad
    Replies:
    0
    Views:
    491
    tshad
    Apr 15, 2005
  2. Vikram

    disable checkbox list checkbox

    Vikram, Jan 25, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    1,363
    ThunderMusic
    Jan 25, 2006
  3. =?Utf-8?B?RG90TmV0RGV2?=

    DataGrid and embeded Checkbox..How to find if checkbox clicked

    =?Utf-8?B?RG90TmV0RGV2?=, Oct 6, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    787
    David Wier
    Oct 6, 2006
  4. Jason Huang
    Replies:
    0
    Views:
    528
    Jason Huang
    Jun 29, 2007
  5. Terje
    Replies:
    5
    Views:
    370
    Evertjan.
    Nov 18, 2004
Loading...

Share This Page