Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Tick Boxes
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Tick Boxes

 Post Reply Post Reply Page  12>
Author
sccs View Drop Down
Groupie
Groupie
Avatar

Joined: 31 October 2002
Location: United Kingdom
Status: Offline
Points: 54
Post Options Post Options   Thanks (0) Thanks(0)   Quote sccs Quote  Post ReplyReply Direct Link To This Post Topic: Tick Boxes
    Posted: 02 November 2005 at 11:39am
I have had to design a page for students at our school. They are asked to submit stories etc for the website. I have set it up so I have to authorise the information before it goes live. This works fine but for one small problem. My admin page shows all the submitted information. Each one has a tick box next to it. Default is False not to show. If I tick the box the information is shown on the site. Great so far. Now when I go back to my admin page, any items that have been authorised to be shown do not have a tick in the box. All boxes are empty so I have no way of knowing which one is showing. I am already using the WebWiz Guestbook on our site but I don't want to use this for this kind of form. Thanks
Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 02 November 2005 at 12:14pm

This depends how the authorization is stored. Do you store a true/false in a database on whether to display the stuff? If so you need to make a connection on the page load and iterate for each story whether it has been approved and set the checkbox accordingly

Back to Top
theSCIENTIST View Drop Down
Senior Member
Senior Member


Joined: 31 July 2003
Location: United Kingdom
Status: Offline
Points: 440
Post Options Post Options   Thanks (0) Thanks(0)   Quote theSCIENTIST Quote  Post ReplyReply Direct Link To This Post Posted: 02 November 2005 at 3:31pm
Yes, like michael said, store the state of the checkbox in the db, that info should be submited along with the rest.

Then, when you read back, don't forget to read the status of the check box, and on rendering the list you have to do a [ If chkStatus from DB = true then ] ... inside the check box to render the check box and assign the property [checked] to it, so it shows the check box ticked up accordingly.
Back to Top
sccs View Drop Down
Groupie
Groupie
Avatar

Joined: 31 October 2002
Location: United Kingdom
Status: Offline
Points: 54
Post Options Post Options   Thanks (0) Thanks(0)   Quote sccs Quote  Post ReplyReply Direct Link To This Post Posted: 04 November 2005 at 4:31am
It is stored as a True/False in the database. Not to sure on how to add the If chkStatus. This is the line of code for the check box:
 
<input name="checkbox" type="checkbox" value="true" accept="<%=(STORY.Fields.Item("Show").Value)%>">
 
Could you go in to a bit more detail. Sorry.
Thanks for your help.


Edited by sccs - 04 November 2005 at 4:39am
Back to Top
theSCIENTIST View Drop Down
Senior Member
Senior Member


Joined: 31 July 2003
Location: United Kingdom
Status: Offline
Points: 440
Post Options Post Options   Thanks (0) Thanks(0)   Quote theSCIENTIST Quote  Post ReplyReply Direct Link To This Post Posted: 04 November 2005 at 5:13am
Ok, you have an ACCEPT property on the INPUT that you might not need, anyway, here's how you do it:

This is when you are reading from the database:


Dim checkED
checkED = ""

'// Here goes you database conn and recordset
'// Then you start rendering


If RS("fld_chkStatus") Then checkED = "checked"

<input name="checkbox" type="checkbox" value="true" <%= checkED %>/>

Note that RS("fld_chkStatus") should be changed to the db field you are storing the true/flase state of the checkbox.

This should work, let me know.
Back to Top
sccs View Drop Down
Groupie
Groupie
Avatar

Joined: 31 October 2002
Location: United Kingdom
Status: Offline
Points: 54
Post Options Post Options   Thanks (0) Thanks(0)   Quote sccs Quote  Post ReplyReply Direct Link To This Post Posted: 04 November 2005 at 6:36am
Hi Thanks for that. Still having a problem. I changed the code as you said. but it still shows no ticks. It now reads:
 
<If RS("fld_Show") Then checkED = "checked">
                &nbs p;                &n bsp;  <input name="checkbox" type="checkbox" value="true" <%= checkED %>/>
 
 
What does the RS stand for?
 
It's only a test page.
Back to Top
theSCIENTIST View Drop Down
Senior Member
Senior Member


Joined: 31 July 2003
Location: United Kingdom
Status: Offline
Points: 440
Post Options Post Options   Thanks (0) Thanks(0)   Quote theSCIENTIST Quote  Post ReplyReply Direct Link To This Post Posted: 04 November 2005 at 7:08am
RS stands for RecordSet, but you have to change it to what you call it in your declarations, such as:


Set RS = Server.CreateObject("ADODB.Recordset")


Look in your code where you have this declaration and change RS in my code to whatever you have in yours.
Back to Top
sccs View Drop Down
Groupie
Groupie
Avatar

Joined: 31 October 2002
Location: United Kingdom
Status: Offline
Points: 54
Post Options Post Options   Thanks (0) Thanks(0)   Quote sccs Quote  Post ReplyReply Direct Link To This Post Posted: 04 November 2005 at 7:47am
Hi. What am I doing wrong.
 
Here is the code:
 
 
First bit
 
 
<%
Dim STORY
Dim STORY_numRows
Dim checkED
checkED = ""
Set STORY = Server.CreateObject("ADODB.Recordset")
STORY.ActiveConnection = MM_consccs_STRING
STORY.Source = "SELECT *  FROM HistoryOfSCCS  ORDER BY SubmitDate DESC"
STORY.CursorType = 0
STORY.CursorLocation = 2
STORY.LockType = 1
STORY.Open()
STORY_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
STORY_numRows = STORY_numRows + Repeat1__numRows
%>
 
 
Bit for checkbox:
 
<If STORY("fld_Show") = "True" Then checkbox = "checkED">
                &nbs p;                &n bsp;  <input name="checkbox" type="checkbox" value="true" <%= checkED %>/>
 
 
 
I am sure it's something very simple but I am unable to see it.
 
Thanks for all your help.
Andy
Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.