Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Another checkbox manipulation question

Reply
Thread Tools

Another checkbox manipulation question

 
 
Jack
Guest
Posts: n/a
 
      02-25-2005
<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;
 
Reply With Quote
 
 
 
 
Mark Schupp
Guest
Posts: n/a
 
      02-25-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> <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;



 
Reply With Quote
 
 
 
 
Jack
Guest
Posts: n/a
 
      02-25-2005
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;

 
Reply With Quote
 
Jack
Guest
Posts: n/a
 
      02-25-2005
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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > <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;

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASPNET CheckBox and a CheckBox in a TemplateField Jason Huang ASP .Net 0 06-29-2007 12:35 AM
DataGrid and embeded Checkbox..How to find if checkbox clicked =?Utf-8?B?RG90TmV0RGV2?= ASP .Net 1 10-06-2006 04:11 PM
disable checkbox list checkbox Vikram ASP .Net 1 01-25-2006 02:59 PM
Text on Checkbox below the checkbox tshad ASP .Net 0 04-14-2005 11:26 PM
checkbox onclick check another checkbox Terje Javascript 5 11-18-2004 11:57 PM



Advertisments