This article describes basic properties of the Lookup control, which you can edit in the designer, but also shows how the same properties can be used dynamically with JavaScript.
Specify text of the title that will appear next to the Lookup control.
JavaScript
This code will allow you to get or set the Lookup control’s title dynamically:
//returns the control's title as a string
fd.control('Control1').title
//sets the control's title
fd.control('Control1').title = 'Last Name'
A unique identifier for the control.
JavaScript
The Name property allows to work with the control via JavaScript code, like this:
fd.spRendered(function(){
//can access the control using its Name:
fd.control('Control1').ready(function(control) {
// alert selected option as a text string
alert(control.value.Title);
});
});
Select if the control will be required to submit the form or not.
JavaScript
This code will allow you to get and set control’s required status
//returns the control's required status as true/false
fd.control('Control1').required;
//sets the control's required status
fd.control('Control1').required = true;
Defines a placeholder text that appears in the input before a user starts typing:
JavaScript
This code will allow you to get or set the control’s placeholder text dynamically:
//sets the control's Hint
fd.control('Control1').placeholder = "Enter your name";
Add a CSS class to the control, which comes in handy with CSS or even JavaScript code. This will work like class attribute for an HTML tag.
Same class can be applied to multiple controls, and then you can use CSS to modify the appearance of these controls. For example, here we’ve used the following CSS code in CSS editor to give controls with my-class a blue background, white text and rounded corners, with a little bit of padding:
.my-class { color: #FFFFFF; padding: 10px; background-color: #1E90FF; border-radius: 30px; }
Add custom CSS style to the control. This will work like style attribute for an HTML tag.
This style will allow you to hide the control, making it invisible to user (but still usable with JavaScript):
display: none;
You can also apply different styles to it. For example, the following style will allow you to add a thin gray border around the control:
padding: 10px; border: 1px solid #CED4DA;
Specify a color for the control’s title text. Select the color from the palette or enter the Hex color code.
Select if the title’s text should wrap in multiple lines when there is not enough space, or just be shortened until it fits (with dots… at the end).
Specify color for the control’s title text. Select the color from the palette or enter the Hex color code.