Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Not saving a + sign????

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-10-04, 02:39
zobernjik zobernjik is offline
Registered User
 
Join Date: Feb 2004
Location: Australia
Posts: 183
Angry Not saving a + sign????

I have a added two new fields to my website, where users will have the ability to enter any character from a standard keyboard.

I will post my code so somebody could look at it,as it seems to be able to save every charc. but the + sign,don't know what is happening there

I am using sql 2000

Fields are DONATIONNUMBER and BLOODGROUP

function SaveDetails()
{
var szRedirect

if (window.thisForm.HospitalID.value == '' ||
window.thisForm.EnteredMonth.value == '' ||
window.thisForm.EnteredYear.value == '' ||
window.thisForm.ProductID.value == '' ||
window.thisForm.FateID.value == '' ||
window.thisForm.UnitsDiscarded.value == '' ||
window.thisForm.DonationNumbers.value == '' ||
window.thisForm.BloodGroup.value == '' ||
window.thisForm.CompiledBy.value == '' ||
window.thisForm.DateCompleted.value == '')
{
window.alert("You must enter all the fields in order to submit the data! Partial details cannot be stored!");
return
}

szRedirect = "HOSPITALID=" + escape(window.thisForm.HospitalID.value);
szRedirect = szRedirect + "&ENTEREDMONTH=" + escape(window.thisForm.EnteredMonth.options(window .thisForm.EnteredMonth.selectedIndex).text + ' ' +
window.thisForm.EnteredYear.options(window.thisFor m.EnteredYear.selectedIndex).text);
szRedirect = szRedirect + "&PRODUCTID=" + escape(window.thisForm.ProductID.value);
szRedirect = szRedirect + "&FATEID=" + escape(window.thisForm.FateID.value);
szRedirect = szRedirect + "&UNITSDISCARDED=" + window.thisForm.UnitsDiscarded.value;
szRedirect = szRedirect + "&COMPILEDBY=" + escape(window.thisForm.CompiledBy.value);
szRedirect = szRedirect + "&DATECOMPLETED=" + window.thisForm.DateCompleted.value;
szRedirect = szRedirect + "&DONATIONNUMBERS=" + escape(window.thisForm.DonationNumbers.value);
szRedirect = szRedirect + "&BLOODGROUP=" + escape(window.thisForm.BloodGroup.value)
window.navigate("Submit.asp?" + szRedirect);

}

------------------------------------------------------------

Call myCon.Execute ("INSERT INTO Bloodbank.dbo.Units (HospitalID, DateEntered, ProductID,FateID, UnitsDiscarded, DateCompleted, " & _
"CompiledBy, DonationNumbers,BloodGroup) VALUES ( " & _
BuildString(Request.queryString("HospitalID").item ) & "," & _
BuildString(Request.QueryString("EnteredMonth").it em) & ", " & _
BuildString(Request.QueryString("ProductID").item) & "," & _
BuildString(Request.queryString("FateID").item) & "," & _
Request.QueryString("UnitsDiscarded").item & ", GETDATE(), " & _
BuildString(unescape(Request.QueryString("Compiled By").item)) & "," & _
BuildString(unescape(Request.QueryString("Donation Numbers").item)) & "," & _
BuildString(unescape(Request.QueryString("BloodGro up").item)) & ")")

Call myCon.Close


What am I doing wrong, or not doing at all?

Thanks and regards
Reply With Quote
  #2 (permalink)  
Old 06-10-04, 20:00
rokslide rokslide is offline
Coffee Minion
 
Join Date: Nov 2003
Location: Sydney
Posts: 1,515
Is the + getting escaped out in your querystring perhaps and thus you lose it??

Drop some debugging into you code to determine exactly where it gets lost.
Reply With Quote
  #3 (permalink)  
Old 06-11-04, 11:52
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
Quote:
Originally Posted by zobernjik
szRedirect = szRedirect + "&DONATIONNUMBERS=" + escape(window.thisForm.DonationNumbers.value);
szRedirect = szRedirect + "&BLOODGROUP=" + escape(window.thisForm.BloodGroup.value)

Looks like your problems might be rooted in the "escape" function of JavaScript. The purpose of this function is to convert non-alphabetic characters to a hexidecimal code. A + sign would be converted to the value %2B.

Is there a reason you're using JS to build a querystring instead of posting the values through the form? You could even use "GET" instead of "POST" in your form to convert the submission into a querystring automatically...

edit
I accidentally gave you the decimal value of 43 instead of the hex value of 2B...
__________________
That which does not kill me postpones the inevitable.

Last edited by Seppuku : 06-11-04 at 12:19.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

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