Forum Moderators: open

Message Too Old, No Replies

Help with insert record form creation

Adding default code to database field.

         

Mechaworx

2:26 pm on Sep 17, 2003 (gmt 0)

10+ Year Member



Hi All,

I have a two part question I'd like some help with.

I'm trying to design a form where users can submit their 120 x 60 pixel banners to a database table complete with a link back to their web site. But I want them to be able to do it with as little error as possible.

Right now I have a form set up where a user copies and pastes the below code into a text area then modify the code from there as below then submit it:

<!--Begin Learn More Banner code-->
<A HREF="http://INSERT YOUR WEB ADDRESS HERE" target="_blank"><img src="Assets/Banners/INSERT YOUR BANNER IMAGE FILE NAME HERE" alt="INSERT NAME OF WEB SITE HERE" width="120" height="60" hspace="3" vspace="3" border="0"></A><br />
<!--End Learn More Banner code-->

In order to prevent typo's in the code from cutting and pasting and inserting information I want the user to just have to enter information ie; url address, alt information and image file name into a form but the whole piece of code above get's entered into the database.

Also once the user hit's the submit button, I want the information to not only get inserted into the database field but also have the form data passed to an email using AspMail.

Is this possible? I'm using Asp VB script Access Database and Dreamweaver MX as a development tool.

Thanks
Gerry

plumsauce

11:05 pm on Sep 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




all of it is possible, in a number of ways.

one way:

in the form, with an onsubmit() action, you can
slice and dice the individual parts in javascript

then you can either push it all back to the server
and return the completed code for cut and paste by
the user, or use onexit() in each field to as the
parsing trigger so that the user can copy the resulting
banner code before submitting.

+++++

Mechaworx

4:13 am on Sep 18, 2003 (gmt 0)

10+ Year Member



Ah!
To be honest, I never considered using a java script application.

Basically you are saying before they even fill in the form, I should direct them to a code generator script which will assemble the pieces of code that includes their information then have the completed code copied and pasted into the form field.

Since I'm new to all this can you direct me to a pre-packaged javascript that I could use?

Thanks
Gerry

mattglet

1:10 pm on Sep 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



you could make a form, where the contents would be 3 textboxes:
- a box to type in the user's url
- a box to type in the alt info
- a box to type in the image info

you would then take those forms fields and attach them to your code like this:

dim strUserURL as string
dim strImageSrc as string
dim strAltInfo as string
dim strDBCode as string

strUserURL = request.form("URLField")
strImageSrc = request.form("ImageField")
strAltInfo = request.form("AltField")

strDBCode = "<!--Begin Learn More Banner code-->" & _
<A HREF="http://" & strUserURL & " target="_blank"><img src="Assets/Banners/" & strImageSrc & " alt=" & strAltInfo & " width="120" height="60" hspace="3" vspace="3" border="0"></A><br />" & _
<!--End Learn More Banner code-->"

then insert "strDBCode" into your database. the user never has to see your banner code, and you don't have to worry about them changing your info either.

-Matt

Mechaworx

4:57 pm on Sep 18, 2003 (gmt 0)

10+ Year Member



then insert "strDBCode" into your database. the user never has to see your banner code, and you don't have to worry about them changing your info either.

Matt,

Would "strDBCode" be the only field name in the database or do I need to modify my table information to include strUserURL strImageSrc and strAltInfo.

Sorry but I'm a bid new to all this.

Gerry

mattglet

3:29 am on Sep 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



if you are only looking to store the banner info, then all you should need is the field to store strDBCode. strDBCode already contains the values of the other variables, so i see no need to store the rest of the info separately.

-Matt