Hidden Input Field

The hidden input field type can be used to store field values that do not require input from a user. The field can be used by developers to store data and since the field will not be added in the form, users cannot see or modify it's values. For example, if a user is trying to add a bug in projects; then the projects which the user is part of is displayed in a drop-down. In case a user is associated with only one project, then the pre-filled input field is used to populate the project details by default and the field is hidden. The attributes for this field are: 

Attribute NameData TypeDescription
typestring
Value should be hidden
Describes the type of form field. 
name*string (50)A unique identifier for the field. On form submission, the value defined for this key will be available in the function associated with the form. 
value*(2000)Provide a default input value for the field.

Syntax


{
  "type": "hidden",
  "name": "",
  "value": ""
}

Example

Let's consider the same example discussed above. If a user is trying to add a bug in projects; then the projects which the user is part of is displayed in a drop-down. In case a user is associated with only one project, then the pre-filled input field is used to populate the project details by default and the field is hidden. 


response = Map();
text = message.get("text");
getPortalId = invokeurl
[
	url :"https://projectsapi.zoho.com/restapi/portals/"
	type :GET
	connection:"Enter your connection name"
];
portalId = getPortalId.get("portals").toMap().get("id");
getProjects = invokeurl
[
	url :"https://projectsapi.zoho.com/restapi/portal/" + portalId + "/projects/"
	type :GET
	connection:"Enter your connection name"
];
allProjects = getProjects.get("projects");
projectlist = List();
for each  project in allProjects
{
	projectName = project.get("name");
	id = project.get("id");
	project = {"label":projectName,"value":id};
	projectlist.add(project);
}
info projectlist.size();
if(projectlist.size() > 1)
{
	
	inputs = list();
	inputs.add({"type":"textarea","name":"note","label":"Bug","hint":"Add a bug","placeholder":"UI issues in RHS","mandatory":true,"value":text});
	inputs.add({"type":"select","name":"project","label":"Project Name","hint":"Choose a project","placeholder":"pick a project","mandatory":true,"options":projectlist});
	inputs.add({"type":"native_select","name":"assginee","label":"Assignee","hint":"Choose an assignee","placeholder":"Choose an assignee","mandatory":true,"data_source":"contacts"});
    return {"type":"form","title":"Add bug","hint":"Add a bug to projects","name":"ID","version":1,"button_label":"Add Bug","action":{"type":"invoke.function","name":"bugs"},"inputs":inputs};
}
else
{
	
	inputs = list();
	inputs.add({"type":"textarea","name":"note","label":"Bug","hint":"Add a bug","placeholder":"UI issues in RHS","mandatory":true,"value":text});
	inputs.add({"type":"hidden","name":projectName,"value":id});
	inputs.add({"type":"native_select","name":"assginee","label":"Assignee","hint":"Choose an assignee","placeholder":"Choose an assignee","mandatory":true,"data_source":"contacts"});
	return {"type":"form","title":"Add bug","hint":"Add a bug to projects","name":"ID","version":1,"button_label":"Add Bug","action":{"type":"invoke.function","name":"bugs"},"inputs":inputs};
}

 

The add bug form displayed to a user who is a part of more than 1 project. 

The add bug form displayed to a user who is a part of only 1 project.