If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
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, 01: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, 19:00
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
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, 10: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 11: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

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