Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

Reducing Round Trips - Working with HTML Checkboxes Expand / Collapse
Author
Message
Posted Sunday, June 13, 2004 11:43 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Monday, May 21, 2012 3:01 PM
Points: 2,642, Visits: 1,131

I take your point on upscaling webservers.  I wish I knew more on the infrastructure side.  Come to think of it, I wish I knew ANYTHING on the infrastructure side

Having talked to the C++ programmers I get the impression that string manipulation is regarded as a necessary evil.  The criticism they make of my approach is that SQL shouldn't be used for string manipulation.

One point on the use of client side Javascript.  There are moves afoot in the UK to make it an offence to create a web-site providing a service to the public that discriminates against people with disabilities.

This is being interpretted as meaning that if your site cannot be used by a blind person, or someone who cannot use a mouse or keyboard then you are discriminating against that person.  There is talk of extending this to the commercial sector which would affect B2B and B2C.

I'm not going to argue the practicalities or morality of this, but UK politicians seem to implement all sorts of things without thinking them through.  Sheer stupidity is not seen as an impediment to an idea.



LinkedIn Profile
Post #120762
Posted Tuesday, September 07, 2004 2:11 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, October 30, 2008 8:17 AM
Points: 2, Visits: 4

Hi,

I think that the same thing can be obtained in a much simpler and effective manner.

The problem consists in updating the IsSelected flag for all topics of a specific contact, according to a configuration of checkboxes. So the web page will build a string containing the id's of checked topics, separated by a non-numeric separator (let's use '#' as separator). The string must begin and end with the specified separator. The update stored procedure might look like that.

CREATE PROCEDURE UpdateContactTopics

@ContactID int,

@ContactTopics varchar(1000) = ''        -- size adjusted as needed

AS

UPDATE Tbl_ContactTopic

SET

IsSelected = CASE WHEN CHARINDEX('|' + CONVERT(varchar, TopicID) + '|', @ContactTopics) > 0 THEN 1 ELSE 0 END

WHERE

ContactID = @ContactID

END

 

The example works identical on single/multiple checked topics and can be easily extended for updating all  topics or all topics of a specific type. I have not included parameters checking or error handling as I wanted only to illustrate the concept.

 




Post #135584
Posted Wednesday, January 12, 2005 1:55 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Wednesday, August 30, 2006 8:14 AM
Points: 79, Visits: 1

When U have multiple items (an array) U can use an xml (create an xml on web server) and send it to the SQL server.

The SQL has the capability of using an xml as a table.

It should be easy enough.

 






Daniel
Post #154959
Posted Tuesday, June 14, 2005 9:18 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, December 21, 2011 2:58 PM
Points: 7, Visits: 35

Quick note for a solution to the missing checkboxes problem. Create a hidden tag for each checkbox needed, and just use the checkboxes to change the values in the hidden tags. Something like this:

<input type="checkbox" tabindex="1"
 name="MoreInfo_aid"
 id="MoreInfo_aid"   onclick="document.all.MoreInfo.value=document.all.MoreInfo_aid.checked;" />
<!-- Matching hidden tag -->
<input type="hidden" id="MoreInfo" name="MoreInfo" value="false" />

We don't actually write all this HTML for each checkbox; a framework handles that. The best thing about this is it follows the usual POST-ing format for FORMs. Sometimes you have to add server code to ignore form elements with "_aid". You also need client side javascript.

All solutions have their provisos.

 

 




Post #190430
Posted Tuesday, April 25, 2006 10:50 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Friday, October 13, 2006 1:17 AM
Points: 12, Visits: 1
In the printable version, for some reason the SSJS doesnt come through and it is replaced with another copy of fnSplitter.

Apart from that, it is a good article and I am going to have a play with it to see if I can do anything with an array of checkboxes on one of our pages.
Post #275414
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse