3 Replies Latest reply on May 24, 2006 4:40 AM by jdeline

    validate textbox

    JohnGree Level 1
      Hi i have 2 small problems

      1. i have a text box which gets submited to an action page where the value is inserted into the table.

      what i need to do is, before the page is submited to the action page

      if the name typed in the text box already exsits in the column names, to show an message box saying name already taken choose another...

      if the name dose not exsit in the column names to go to the action page.

      2. with message boxes is there a way of centering the message? i have used \n for line breaks.

      hope someone can help

        • 1. Re: validate textbox
          Dan Bracuk Level 5
          Problem 1 - The only way to do this prior to going to the action page is to query every record and send the values to a javascript array. If you have a lot of records, this will make your form page painfully slow. You are probably better off letting the user submit the form and run a query to see if the value has been used.

          Problem 2 - What's a message box? Is that the same as a textarea? If so, what do you mean by centred?
          • 2. Re: validate textbox
            JohnGree Level 1
            ok thanks

            if i let the user submit the query how can i check to see if the name exsists, and if it dosnt exsist i would need it to go back a page so the user could try again how would i do this

            i just need to center the text of a pop up message box when using a cfform required message

            many thanks
            • 3. Re: validate textbox
              jdeline Level 1
              When the form is submitted, have the action page query the database to see if the name already exists. If it does, do a CFLOCATION back to the form page. You can put a message in the CFLOCATION URL that says:
              ?msg=The name already exists. When you load the form page, check to see if URL.msg is defined. If so, display the message.