Results 1 to 4 of 4

Thread: Script Help (many-2-many)

  1. #1
    Join Date
    Jul 2007
    Posts
    59
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Script Help (many-2-many)

    if i have

    customer
    -cid
    -name
    -lasname

    contact
    -cid
    -telephone

    and i want to add telephone like 10 number how can i write the java for add textfield for add number and how can i put on database

    thank

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Firstly, that's a one-to-many relationship: there's no way for one telephone number to belong to multiple customers. Secondly, what exactly are you talking about? You've posted this in the Javascript forum, then you're talking about Java, then you want to add a textbox? Do you have some form of Java serverside?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Jul 2007
    Posts
    59
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    PHP Code:
    <div id="input">
    <
    input type="text" name="telephone1">
    </
    div>
    <
    input type="button" value="เพิ่ม" onclick="add()">
    <
    script>
    var 
    counter=1;
    function 
    add(){
    counter+=1;
    document.getElementById("input").innerHTML+="<br><input type='text' name='telephone"+counter+"'>";
    }
    </script> 
    something like this i mean i customer can have more than 1 phone number but i dont want to fix the number for each customer

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Ah:
    Code:
    <script type="text/javascript">
      function addTelephoneInput() {
        var inp = document.createElement("input");
        inp.type = "text";
        inp.name = "telephone"; // If using PHP, this has to be "telephone[]" due to PHP's limited capabilities.
        document.getElementById("input").appendChild(inp);
      }
    </script>
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

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