diegolimahif

Help with Javascript to Dynamic Fields

Discussion created by diegolimahif on Nov 4, 2014
Latest reply on Nov 7, 2014 by Chris_Hackett

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"));

  }

  }

Attachments

Outcomes