Forum Moderators: open

Message Too Old, No Replies

Changing Text in One Form Box and Putting it in another

Please help :)

         

someone788

11:52 pm on Mar 7, 2006 (gmt 0)

10+ Year Member



Would appreciate some help coming up with the script for this...

Ok, there is going to be one form box, under it a button, and under the button another form box.

I want to have a user be able to type something in the top form box, for example 'The man walked down the street' and when you click the button, it will appear in the bottom form box exactly as it was typed in above, except all instances of 'the' will be changed to 'a' making it 'a man walked down a street'.

So the user would type in 'the man walked down the street' press the button, and it would come out in the below form box as 'a man walked down a street'. It would replace all instances of 'the' with 'a' no matter what the text in the above form box was.

Thanks.

whoisgregg

11:58 pm on Mar 7, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What code do you have so far? Are you hung up on how to replace occurences of "the" with "a" or also the retrieving and setting of input value?

someone788

1:12 am on Mar 8, 2006 (gmt 0)

10+ Year Member



I've been searching around, but I don't have any code currently.

whoisgregg

3:00 am on Mar 8, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Once you knock together the basic code and post it here, I'm sure there are plenty of folks who would be happy to help with the parts you have trouble with.

When researching how to change "the" to "a", keep in mind case sensitivity (The, tHe, thE, etc.), that the string "the" can be parts of other words (theater, then, there, etc.), and what characters will be on either side of the string. Those considerations will practically require a regular expression.