|
| |
|
|
Twopigs
Posts: 147 Joined: 8/22/2002 Status: offline
|
if statement to send cdonts - 10/7/2005 13:05:05
I've been driving everyone crazy with my questions i'm sure, but I may have another workaround to my problem. I am going back to my first setup which is to throw all info into one field in one record: so the Mailfrom Field in one record would look like this: ML_2345,ML_1575,ML_2235 I have the page that puts check boxes "checked" next to a vendor name if the vendor# is in the mailfrom field. My question is.........is there a way you can update a field to add a value? Not just overwrite the whole field. That way I could keep what I have working and have them go to the vendors details, and if they pick "Yes, i want e mail from this vendor" it will "add" the value to the field not just overwrite the whole field. Is this even possible? Thanks in advance!
_____________________________
|
|
|
|
Twopigs
Posts: 147 Joined: 8/22/2002 Status: offline
|
RE: if statement to send cdonts - 10/7/2005 14:13:46
Sorry, i'm still a novice....... Do I add that to my insert script or the form? I have a hidden form field called "NewMailfrom" Which will grab the rs(ID) and add ML_ to it. Now i'm not sure where put it? I think this will work once I get how it all connects. :) Thanks a bunch Bobby!
_____________________________
|
|
|
|
Twopigs
Posts: 147 Joined: 8/22/2002 Status: offline
|
RE: if statement to send cdonts - 10/7/2005 14:35:55
Nope, just using straight Coding. I use Homesite 5 and write everything in asp and java. It's funny, i'm still trying to sort it all out, i'll get it to work...I may have to ask a few more questions though ...? Thanks for helping out!
_____________________________
|
|
|
|
Twopigs
Posts: 147 Joined: 8/22/2002 Status: offline
|
RE: if statement to send cdonts - 10/7/2005 14:43:18
I wonder if i'm moving in the right direction here.... Here is the code I have on the page: <form action="Mailfrom-Custlist-insert.asp" method="post">
<input type="Hidden" name="NewMailfrom" value="ML_<%=rs("id")%>">
<input type="Hidden" name="OldMailfrom" value="<%=ATTrs("mailfrom")%>">
<input type="Hidden" name="vendid" value="<%=rs("id")%>">
<input type="submit" name="Submit" value="I want updates from this vendor">
</form> this is what it looks like when I veiw the source: <input type="Hidden" name="NewMailfrom" value="ML_2937"> <input type="Hidden" name="OldMailfrom" value="ML_2926,ML_1675,ML_2688"> <input type="Hidden" name="vendid" value="2937"> <input type="submit" name="Submit" value="I want updates from this vendor"> So now when they submit I need it to take the "OldMailfrom" and add "NewMailfrom" value and put them in the Mailfrom field so it looks like this: ML_2926,ML_1675,ML_2688,ML_2937
_____________________________
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: if statement to send cdonts - 10/7/2005 14:56:16
mailFrom = Request.form("OldMailFrom") & "," & Request.form("NewMailFrom") that will combine the two upon submit.
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
Twopigs
Posts: 147 Joined: 8/22/2002 Status: offline
|
RE: if statement to send cdonts - 10/7/2005 15:55:59
is it possible to delete a value? for example if the field has ML_2926,ML_1675,ML_2688,ML_2937 and I want to just take out ML_1675 I can have a hidden field in the form bring over the value ML_1675 but then not sure how to tell the script to look in Mailfrom and delete Just that. any suggestions?
_____________________________
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: if statement to send cdonts - 10/7/2005 16:10:32
<%myFieldValue = Replace(myFieldValue,stringToBeRemoved,"")%> so in your case, it would be: <%Mailfrom= Replace(Mailfrom,"ML_1675,","")%> I included the comma so it would be removed but that could be a problem if you're trying to remove the last one. So I'd adapt that just a little to this" <%Mailfrom= Replace(Replace(Mailfrom,"ML_1675",""),",,",",")%> The bold stuff would change any double commas to singles. That help?
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
Twopigs
Posts: 147 Joined: 8/22/2002 Status: offline
|
RE: if statement to send cdonts - 10/7/2005 16:22:29
cool..... The page they are coming from will have the vendid (ML_1675) in this case, but it changes depending on the page they are on. Question is, how to I write it so it says request.form(vendid) where the "ML_1675" is in the line below..... I'm missing some quotes or something. <%Mailfrom= Replace(Replace(Mailfrom,"ML_1675",""),",,",",")%>
_____________________________
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: if statement to send cdonts - 10/7/2005 16:28:02
quote:
<input type="Hidden" name="vendid" value="2937"> Is it that one? If so then use this: <%Mailfrom= Replace(Replace(Mailfrom,"ML_"&Request.Form("vendid"),""),",,",",")%>
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
Twopigs
Posts: 147 Joined: 8/22/2002 Status: offline
|
RE: if statement to send cdonts - 10/7/2005 16:42:29
I know i'm so close........thanks you guys... It seems to be overwriting and deleting everything in the field. I'm sure it's because I have an extra something in the sql script. here's what I got: sql = "Update Custlist Set"
sql = sql & " Mailfrom='" & replace(Replace(Mailfrom,"ML_"&Request.Form("vendid"),""),",,",",") & "'"
_____________________________
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: if statement to send cdonts - 10/7/2005 19:58:10
quote:
It seems to be overwriting and deleting everything in the field. That's not a good thing. Is that line inside a loop? How 'bout if right after that line we put 2 lines: Response.write(sql) Response.end Then we can see the exact SQL being sent to the db.
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
Twopigs
Posts: 147 Joined: 8/22/2002 Status: offline
|
RE: if statement to send cdonts - 10/8/2005 13:05:20
I tried that and it just pops up: Update Custlist Set Mailfrom='' This might explain it better. I have one page that is the company details and a form they submit if they want to remove this exhibitor from their list. Here is the form on the page: <form action="Mailfrom-Custlist-remove.asp" method="post">
<input type="Hidden" name="OldMailfrom" value="<%=ATTrs("mailfrom")%>">
<input type="Hidden" name="vendid" value="<%=rs("id")%>">
<input type="submit" name="Submit" value="I don't want email from them anymore">
</form>
<% Else %>
<form action="Mailfrom-Custlist-insert-test.asp" method="post">
<input type="Hidden" name="NewMailfrom" value="ML_<%=rs("id")%>">
<input type="Hidden" name="OldMailfrom" value="<%=ATTrs("mailfrom")%>">
<input type="Hidden" name="vendid" value="<%=rs("id")%>">
<input type="submit" name="Submit" value="I want updates from this vendor">
</form> Then as you see, it goes to "Mailfrom-Custlist-remove.asp" Here is the whole page: <% response.buffer = true %>
<!--#include file="connection06.asp"-->
<%
sql = "Update Custlist Set"
sql = sql & " Mailfrom='" & replace(Replace(Mailfrom,"ML_"&Request.Form("vendid"),""),",,",",") & "'"
sql = sql & ", MODIFIED='" & date() & "'"
sql = sql & " where MFID =" & session("attendeeid")
response.write sql
Set rs = conn.Execute(sql)
conn.Close
set rs = Nothing
Set conn = Nothing
response.redirect "Exhibitor_List_06_Custlist.asp?stat=removeML"%> Do you know of any online documents eplaining the sql so I could understand what that line means? I'm trying to figure out what all the single and double qoutes do and the "&" I'm thinking it's one little thing. by putting in response.write(sql) response.end I can see it's not bringing anything over.
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: if statement to send cdonts - 10/8/2005 22:01:51
quote:
sql = sql & " Mailfrom='" & replace(Replace(Mailfrom,"ML_"&Request.Form("vendid"),""),",,",",") & "'" From the looks of the bigger picture, the issue may be right with this line. The way I see it, the second Mailfrom has no values. Try this one: sql = sql & " Mailfrom='" & replace(Replace(Request.form("OldMailfrom"),"ML_"&Request.Form("vendid"),""),",,",",") & "'" Try doing that and then: Response.write(sql) Response.end and see if that's any better.
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
|
|
Twopigs
Posts: 147 Joined: 8/22/2002 Status: offline
|
RE: if statement to send cdonts - 10/9/2005 22:17:50
Rdouglass.........you save the day again...I think that's it. I was stressin over other things, that I overlooked that! There is no value from Mailfrom, only Oldmailfrom that was sent from the form! Thanks so much. Here's the out put, I had ML_2937 in the field,and when I go to that exhibitors listing and click on .."I don't want mail from this exhibitor" this is what the response.write is bringing back: Update Custlist Set Mailfrom=',ML_2688,ML_1593' Meaning it should work! Do you think that comma at the begining will be a problem?
_____________________________
|
|
|
|
rdouglass
Posts: 9280 From: Biddeford, ME USA Status: offline
|
RE: if statement to send cdonts - 10/10/2005 8:20:48
quote:
sql = sql & " Mailfrom='" & replace(Replace(Request.form("OldMailfrom"),"ML_"&Request.Form("vendid"),""),",,",",") & "'" I didn't factor in removing the first item when I did the "double comma" thing. I think we should be able to fix it this way: ... myTempMailList = replace(Replace(Request.form("OldMailfrom"),"ML_"&Request.Form("vendid"),""),",,",",") IF left(myTempMailList,1) = "," THEN myTempMailList = Right(myTempMailList,Len(myTempMailList)-1) END IF sql = sql & " Mailfrom='" & myTempMailList & "'" ... What I did was basically check the first character. If it is a comma, then remove the first character. Else leave it alone. That should take care of all the situations. How's that?
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|