Re: [input] .... [/input] usage

This WebDNA talk-list message is from

2005


It keeps the original formatting.
numero = 61529
interpreted = N
texte = The following steps/example illustrate how to take a textarea input in which the user presses enter(s) to format their entered data themselves, and then append it to a database, and later retrieve it, displaying it on the screen with the enter(s) that they had put in themselves. 1. You need a form with a textarea. When initially coding this form, there is no need (i'm 99% sure on this) to have the [input] tag, however it does not hurt anything one bit, so go ahead and pop it on in there....ex: 
   In reality, what the input tags do is convert return characters back into the linefeeds necessary to properly redisplay text into a textarea box. Since you have to text to convert, they make no difference here, but it's good to get into the habit of using them. 2. Next, you want to append this to a database using the [URL] tag. [append db=mydb.db]RID=1234&ATextArea=[URL][_atextarea][/URL][/append] Why the URL? Special control characters sometimes f*ck up webcat commands. This is bad. Using [URL] fixes that problem. In some cases, a user may have entered in the text "Sally & Jessy". This would confuse webcat because it then replace the variable in the append like so: [append db=mydb.db]RID=1234&ATextArea=Sally & Jessy] When it reaches that "&", it thinks it's now looking at a new field. URL'izing it prevents this error from happening. This is similar when you're comparind strings of text in showifs, and the text happens to contain other comparison operators....but that is digressing from this lesson. In this case, the [URL] will modify those control characters into something that it can handle easily. 3. Displaying. Now comes the easy stuff... [convertchars][lookup db=mydb.db&value=1234&lookinfield=RID&returnfield=ATextArea¬Found=ERR OR][ /convertchars] do a search, a lookup, whatever. The convertchars will by default use the defaultconversions.db, which by some odd coincidence, has an entry that converts %0B (a textarea's line feed, URL'ized) to a
tag. If you're removed this entry, put it back, or make a new convertchars db, and reference it with the optional db= tag for convertchars. If you correctly follow these 3 steps, then you'll be able to properly display the text that users typed in, with their provided line feeds. If you ever need to allow them to edit their masterpieces, make sure that when you autofill in the > > It gets written into the db like this: > &BlogText=[url][BlogText][/url] > > Data gets placed back into a form > from the db for editing like this: > > > > > In a text field I do this: > > > It gets written into the db like this: > &BlogTitle=[url][BlogTitle][/url] > > Unless I do this in my "edit" form text field after I > snatch data from the db: > value="[input][BlogTitle][/input]" size="50"> > > I see nothing in the textfield if the data has a > special character like a quote mark surrounding a word > etc. > > BUT I've never really used [input][/input] with a > simple text field when I've placed data back into a > form for editing.... never ran into any problems > before I guess.... > > Today I did LOL > > The docs sorta only say to use the [input][/input] > tags within   In reality, what the input tags do is convert return characters back into the linefeeds necessary to properly redisplay text into a textarea box. Since you have to text to convert, they make no difference here, but it's good to get into the habit of using them. 2. Next, you want to append this to a database using the [url] tag. [append db=mydb.db]RID=1234&ATextArea=[url][_atextarea][/URL][/append] Why the URL? Special control characters sometimes f*ck up webcat commands. This is bad. Using [url] fixes that problem. In some cases, a user may have entered in the text "Sally & Jessy". This would confuse webcat because it then replace the variable in the append like so: [append db=mydb.db]RID=1234&ATextArea=Sally & Jessy] When it reaches that "&", it thinks it's now looking at a new field. URL'izing it prevents this error from happening. This is similar when you're comparind strings of text in showifs, and the text happens to contain other comparison operators....but that is digressing from this lesson. In this case, the [url] will modify those control characters into something that it can handle easily. 3. Displaying. Now comes the easy stuff... [convertchars][lookup db=mydb.db&value=1234&lookinfield=RID&returnfield=ATextArea¬Found=ERR OR][ /convertchars] do a search, a lookup, whatever. The convertchars will by default use the defaultconversions.db, which by some odd coincidence, has an entry that converts %0B (a textarea's line feed, URL'ized) to a
tag. If you're removed this entry, put it back, or make a new convertchars db, and reference it with the optional db= tag for convertchars. If you correctly follow these 3 steps, then you'll be able to properly display the text that users typed in, with their provided line feeds. If you ever need to allow them to edit their masterpieces, make sure that when you autofill in the > > It gets written into the db like this: > &BlogText=[url][BlogText][/url] > > Data gets placed back into a form > from the db for editing like this: > > > > > In a text field I do this: > > > It gets written into the db like this: > &BlogTitle=[url][BlogTitle][/url] > > Unless I do this in my "edit" form text field after I > snatch data from the db: > value="[input][BlogTitle][/input]" size="50"> > > I see nothing in the textfield if the data has a > special character like a quote mark surrounding a word > etc. > > BUT I've never really used [input][/input] with a > simple text field when I've placed data back into a > form for editing.... never ran into any problems > before I guess.... > > Today I did LOL > > The docs sorta only say to use the [input][/input] > tags within