Announcement

Collapse
No announcement yet.

How to auto fill in multi textbox?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to auto fill in multi textbox?

    I am a new user

    May i know how to auto fill in multi textbox?

    For example,

    Invoice Form

    I select the client name textbox , input AB , AUTO complete will display ABC company, ABO company .....

    then I select ABC company

    * I want another text box will AUTO fill in Phone number , email, address something like that

    May i know how to do it, Thanks

  • #2
    The approach would be creating an autocomplete field on name. Then create an ajax event onchange on this field. In this event you can do a sc_select to retrieve the additional data and store that in the fields.
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment


    • #3
      //PTAutoFill1 Loading @105-4468D8C9
      function employeesemp_namePTAutoFill1_start(sender) {
      new Ajax.Request("services/employees.php?keyword=" + encodeURI($("employeesemp_name").value), {
      method: "get",
      requestHeaders: ['If-Modified-Since', new Date(0)],
      onSuccess: function(transport) {
      var valuesRow = eval(transport.responseText)[0];
      getSameLevelCtl("employeestitle", sender).value = valuesRow["title"];
      getSameLevelCtl("employeesdepartment_id", sender).value = valuesRow["department_id"];
      getSameLevelCtl("employeesemail", sender).value = valuesRow["email"];
      getSameLevelCtl("employeesphone_home", sender).value = valuesRow["phone_home"];
      getSameLevelCtl("employeesphone_work", sender).value = valuesRow["phone_work"];
      getSameLevelCtl("employeesphone_cell", sender).value = valuesRow["phone_cell"];
      getSameLevelCtl("employeesfax", sender).value = valuesRow["fax"];
      getSameLevelCtl("employeescity", sender).value = valuesRow["city"];
      getSameLevelCtl("employeeszip", sender).value = valuesRow["zip"];
      getSameLevelCtl("employeesaddress", sender).value = valuesRow["address"];
      $("employeespicture").src = valuesRow["picture"];
      $("employeesemp_id").value = valuesRow["emp_id"];
      employeesemp_nameHideShow1_show(sender);
      employeesemp_nameHideShow4_hide(sender);
      },
      onFailure: function(transport) {
      alert(transport.responseText);
      }
      });
      }
      //End PTAutoFill1 Loading


      only paste it on ajax event onchange?

      Comment

      Working...
      X