3 Replies Latest reply: Mar 17, 2014 8:39 AM by Doolius RSS

    Add commas between values in textbox

    Doolius

      Problem: Users need to be able to paste values into a text box and/or textarea and click a button that will take those values and show them the output with commas inserted.

       

      ex:

      User Input

      val1

      val2

      val3

      Output

      val1,val2,val3

       

      other situation

      Is there a way to compare the values to a list created from table values and parse that way? this is different from above because the values might have spaces but still be the same value.

       

      ex:

      User Input

      this is value one

      this is value two

      this is value three

      Output

      this is value one, this is value two, this is value three

       

      So for that I would want to take what the user input, and try and match it to different values in a certain column in my table if that makes sense

        • 1. Re: Add commas between values in textbox
          Pavan

          hi,

          you can do this by using JavaScript on button click write a function to concatenate values and commas

          sample code

          <script>
          function myFunction()
          {
          document.getElementById("id").value=document.getElementById("id1").vlaue +','+document.getElementById("id2").vlaue+','
          +document.getElementById("id3").vlaue;
          }
          </script>
          
          

          and also you can compre the values in JavaScript.

           

          Regards,

          Pavan

          • 2. Re: Add commas between values in textbox
            vdsadhi

            Hi Steven,

             

            In case of your first example, we can create a computation after submit and replace the space with comma then try to insert into table by splitting the values based on comma in the process (after submit) as per your requirement.

            In case of second example, we can't do computation to replace the space with comma since the values are in sentence form. Why can't you educate your user to add comma in each and every sentence, then it will be easy to insert into the table using pl/sql code in process.

             

            please let me know if your doubts on this.

             

            Regards,

            Lakshmi

            • 3. Re: Add commas between values in textbox
              Doolius

              I received an answer for what I was wanting to accomplish on one of my other forum questions:

              https://community.oracle.com/thread/3531549

               

              But I don't know if it will work with the spaces yet.

               

              Lakshmi, the users currently do insert commas where needed before they search. But it is sometimes time consuming because they copy everything from a spreadsheet and at times could be copying 30+ values and they don't like to have to go through all of them and insert a comma where necessary.

               

              Thanks for the help

              Steven