Nodyce 02-19-2002, 08:01 PM Hey guys and gals...
I currently market a script that requires my customers to actually open up the script itself and change some things to fit with their site (ei. email address, pop-up text, web site URl)
I would like to create (or have a program created) that allows people to fill their info into different fields, and then the customized script is created in a text box below. Do you think VB is a good way to go about accomplishing this? What are your other thoughts?
dcl3500 02-19-2002, 08:10 PM You mean like doing a custom letterhead or something along those lines?
If that is the case you can store all that info in several ways.
[list=1]
A text file.
The registry
An INI file
A database
[/list=1]
You can then read that info back using whatever your preferred methods are and use it in your app however is needed.
Nodyce 02-19-2002, 08:14 PM Actually I don't even think it needs to be that complicated. All it needs to do is basically place data entered in certain fields into their appropriate places within my javascript code. It then needs to render the new, customized code so that all the user has to do is copy and paste it into their website and they'll be ready to roll.
Does this make sense?
dcl3500 02-19-2002, 08:19 PM Ah Javascript! Hmmm, VB forum. Are you doing this project in VB or Java?
If it is VB then one of the ways I suggested will work. Or, maybe you could have a series of textboxes that the user could enter the data at runtime and then if you have/create a tool to generate the appropriate java script you could put it in a textbox so it could be copied to an html editor. Maybe there is such an animal already out there in the world, but I haven't heard or seen of it.
Nodyce 02-19-2002, 08:23 PM Hmmm...maybe VB isn't the best program to go about accomplishing this with. Like I said, I'm still very new when it comes to VB and so I just wanted to make sure. Thanks again for all your help.
Try this webpage and see if it is what your looking for (or similar):
Form Script (http://www.tearsforfreedom.com/script.asp)
If so, here's the code:
<html>
<head>
<title>MoMo is a Pimp</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<%
Response.Write "<b>Hello</b>"
%>
<p>
<br>
<br>
<%
If Request.Form("hidden") = 1 Then
Response.Write "<form name=form1 method=post action=script.asp>"
Response.Write "<textarea name=textfield cols=40 rows=10>" & Request.Form("name") & vbCrLf
Response.Write "Code related to the users name" & vbCrLf & vbCrLf & Request.Form("email")& vbCrLf
Response.Write "Code related to the users email" & vbCrLf & vbCrLf & Request.Form("earl") & vbCrLf
Response.Write "Code related to the users earl (URL)"
Response.Write "</textarea>"
Response.Write "<input type=hidden name=hidden value=0>"
Response.Write "<p><input type=submit value=Return></p>"
Response.Write "</form>"
Else
Response.Write "<form name=form1 method=post action=script.asp>"
Response.Write "<input type=hidden name=hidden value=1>"
Response.Write "<p><input type=text name=name>First Name</p>"
Response.Write "<p><input type=text name=email>Email</p>"
Response.Write "<p><input type=text name=earl>Earl</p>"
Response.Write "<p><input type=submit value=Submit></p>"
Response.Write "</form>"
End If
%>
</body>
</html>
Hope that helps. :P
whatever language you use you should be able to accomplish this fairly easily with string and variable concatenation
pseudocode:
strEmail=txtEmail.text
strURL=txtURL.text
strHTML="<html><body>My email address is " & strEmail & _
", my website is at " & strURL & "</body></html>"
cabin boy 02-20-2002, 07:07 AM You could quite easily do what you want.
Just make a form with textboxes on it in which the customer will enter their personal information (Call these emailTextbox, URLTextbox etc.)
Have another textbox which will display the gererated text. (outputTextbox)
Then have a command button and put some code similar to this in
the command_click event:
(things with an 's' in front of them are variables. Ive put an 's' in front of them to make it clear to you rather than because of any requirements.)
Private sub command1_click()
emailTextbox.setfocus
semailaddress = emailtextbox.text
URLTextbox.setfocus
sURLaddress = URLtextbox.text
'etc. etc. etc for all the personalised data you want.
outputTextbox.setfocus
soutputTextbox.text = "Write all of your script in here and
whenever you want your custom data in it, do this. The customer's email address is:" & emailaddress & "then put more script and then, " & URLaddress & "until all your script is written"
End Sub
That will output your script into a text box. If you want it in a file then add this:
sdata = outputTextbox.text
Open "filenamehere.zzz" for output as 1
Write #1 sdata
Close #1
It's not very elegant or efficient code but it's simple and will do what you want. (I hope) ;)
ChiefRedBull 02-20-2002, 07:41 AM Just to clarify what cabin boy explained above...
You dont need to setFocus to a control in order to set a variable to its contents.
Place textboxes on your form, and use their values in the code.
Dim strURL As String
Dim strEmail As String
Dim strCode As String
' set the variables to the user entered values
strUrl = txtURL.Text
strEmail = txtEmail.Text
' construct the code string, placing the user entered values at certain points
strCode = "Customers email: " & strEmail & vbCrLf & _
"Website URL: " & strURL
' show the generated code in another textbox
txtCode.Text =strCode
HedleyKow 02-20-2002, 07:10 PM Personally, I would do everything in vbscript. Although I have very limited experience in VBScript and haven't used input boxes, I'm assuming you can have input boxes. Have the vbscript have an input box requesting each of the things you want, have the user enter them, and then the script executes just as it does now except that it uses the strings returned from the input boxes rather than text values.
This way, you still only have one file, no dependencies (unless vbscript has dependencies and I'm unaware of it), and you get the ease of use.
dcl3500 02-20-2002, 07:24 PM Headley,
Input boxes are terrible IMO, they interupt program flow, are obtrusive as all get out, and just plain annoying. A better practice is just make the user complete the neccessary steps on a form. If they have initiated something make them finish it or give them an option to cancel it if they choose to.
Pick up a copy of About Face by Alan Cooper. He has many things to say about inputboxes and message boxes. None of them good though. :eek:
|