Results 1 to 4 of 4
  1. #1
    raju.i is offline Member
    Join Date
    Jan 2010
    Posts
    9
    Rep Power
    0

    Default Help Needed in Solving the Following Isuue.

    Hi,
    I am working on a task, which has a text box and on exit of a text box we need to get the remaing content, for example in google when we start wrting some letter in the text box we will be getting all related content which starts with that perticular letter, As of now we are not calling any ajax methods.

    here is the code which i am working on:


    <script type="text/javascript">



    function getContentByText(element){
    var text = element.value;

    var response = getEmailAddresses(text);
    processResponseTable(response);

    }

    function getEmailAddresses(text)
    {
    //send input text as part of ajax request
    //once the ajax is posted,we can get the response
    //response will be as shown below which we then process
    var testString="test@google.com; att@att.com; vz@verizon.com; test2@gmail.com; note@gmail.com";
    return testString;
    }

    function processResponse(text){
    var addresses = testString.split(';');
    if(addresses){

    var temp='';
    for(var i=0; i<addresses.length ; i++){
    temp = temp+addresses[i];
    temp = temp+'\n';
    }

    var nextelement = document.getElementById("2email");
    nextelement.value = temp;
    }

    }

    function processResponseTable(textString){
    alert(textString);
    var addresses = textString.split(';');

    if(addresses){
    alert(addresses);

    var temp='<table>';
    for(var i=0; i<addresses.length ; i++){

    temp = temp+'<tr><td>';
    temp = temp+addresses[i];
    temp = temp+'</td</tr>';
    }
    temp = temp+'</table>';

    var nextelement = document.getElementById("results");
    if(nextelement){
    alert("nextelement");
    }

    nextelement.innerHTML = temp;

    }

    }

    </script>






    <table>
    <tr><td id="bodyText" nowrap colspan="2"><input type="radio" name="catagory" checked="checked" value="CAN" >CAN <input type="radio" name="catagory" value="PCAN" >PCAN <input type="radio" name="catagory"value="BTN" >BTN &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="TEXT" onblur="getContentByText(this)" type="text" size="20"</td></tr>
    <tr><td id="bodyText" nowrap>To Email/Fax <span id="requiredText" >*</span></td>
    <td id="bodyText" align="right"><input name="TO_EMAIL" type="text" size="36" value="<%=emailID %>" ></td></tr></table>



    In the above code we are having a text box with size 20. when we type letter a and exit of tht we need to get all the related data in to the To Email/Fax text box. in this case we will get att@verizon.com
    if t we need to test@gmail.com and test2@gmail.com

    when i type any letter i am getting all the content, no matter which letter it starts with.



    Thank you in advance.

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,014
    Rep Power
    20

    Default

    I see no Java...

  3. #3
    raju.i is offline Member
    Join Date
    Jan 2010
    Posts
    9
    Rep Power
    0

    Default

    Ya, it just got the text boxes in html whih calls a function, usually we will get those deatils using AJAX but we dont have tht functionality right now. so our main thing is how do we get the specfic content with the above code. As i mentioned.

  4. #4
    Sno's Avatar
    Sno
    Sno is offline Senior Member
    Join Date
    Apr 2010
    Posts
    196
    Rep Power
    5

    Default

    .. I think he means, This isn't java, its javascript, Huge difference.
    :rolleyes: ~ Sno ~ :rolleyes:
    '-~ B.S. Computer Science ~-'

Similar Threads

  1. Solving a Maze
    By bdario1 in forum New To Java
    Replies: 4
    Last Post: 04-14-2010, 12:02 AM
  2. I need help solving this problem.
    By Felicia in forum New To Java
    Replies: 5
    Last Post: 03-04-2010, 08:40 PM
  3. Pls help me in solving this java question
    By dunnoGUy in forum New To Java
    Replies: 1
    Last Post: 02-28-2010, 07:10 AM
  4. 4x4 2D array card game,need solving
    By highschool in forum New To Java
    Replies: 6
    Last Post: 02-25-2010, 03:36 PM
  5. I need a help in solving this method using vectors
    By java_fun2007 in forum New To Java
    Replies: 2
    Last Post: 11-26-2007, 07:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •