CA Service Management

 View Only
  • 1.  Help with Javascript to Dynamic Fields

    Posted Nov 04, 2014 09:00 AM
      |   view attached

    Hey guys!

     

    We are using SDM r12.7!

     

    My client needs to discriminate on the request form the number of services being requested, for it i created an attribute called "quantity service", this attribute will be filled to enable a tab with fields for description of each service.

     

    I tried this using the properties of the category, but the solution was not accepted.

     

    I researched for some javascripts to perform the activity, i found one and created a new tab form with this javscript and a button to add the field.

     

    Can tell what I'm doing wrong?

     

    Thank you so much!

     

    The detail_in is attach to this topic

     

    The Javascript:

     

    function addFields(){

    if ("$prop.form_name_3" == "edit")

      var number = document.getElementById("member").value;

      var container = document.getElementById("container");

      while (container.hasChildNodes()) {

      container.removeChild(container.lastChild);

      }

      for (i=0;i<number;i++){

      container.appendChild(document.createTextNode("Serviço " + (i+1)));

      var input = document.createElement("input");

      input.type = "text";

      container.appendChild(input);

      container.appendChild(document.createElement("br"));

      }

      }



  • 2.  Re: Help with Javascript to Dynamic Fields

     
    Posted Nov 07, 2014 01:48 PM

    Hi All - Any suggestions here for Diego? Thanks! Chris

    Diego Lima wrote:

     

    Hey guys!

     

    We are using SDM r12.7!

     

    My client needs to discriminate on the request form the number of services being requested, for it i created an attribute called "quantity service", this attribute will be filled to enable a tab with fields for description of each service.

     

    I tried this using the properties of the category, but the solution was not accepted.

     

    I researched for some javascripts to perform the activity, i found one and created a new tab form with this javscript and a button to add the field.

     

    Can tell what I'm doing wrong?

     

    Thank you so much!

     

    The detail_in is attach to this topic

     

    The Javascript:

     

    function addFields(){

    if ("$prop.form_name_3" == "edit")

      var number = document.getElementById("member").value;

      var container = document.getElementById("container");

      while (container.hasChildNodes()) {

      container.removeChild(container.lastChild);

      }

      for (i=0;i<number;i++){

      container.appendChild(document.createTextNode("Serviço " + (i+1)));

      var input = document.createElement("input");

      input.type = "text";

      container.appendChild(input);

      container.appendChild(document.createElement("br"));

      }

      }