- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2019 07:08 PM
Hi all,
I'm building a custom widget to present a custom form in Service Portal, and need to build a Select Box type variable...and I'm struggling with the script in the HTML field of the widget. Here's where I'm at so far, I got this from Stackoverflow.com and am trying to manipulate for my need. Anyone done this before? Thanks!
<div class="select">
<select [(ngModel)]="corporationObj" class="form-control col-lg-8" #corporation required>
<option *ngFor="let corporation of corporations"></option>
</select>
</div>
Solved! Go to Solution.
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2019 12:17 AM
<div class="form-group">
<label for="technology">What technology is this related to?</label>
<select id="technology" name="technology"
ng-model="c.data.technology" class="form-control">
<option value="">--None--</option>-->
<option value="1">Help Desk</option>
<option value="2">IT</option>
<option value="3">Payroll</option>
</select>
</div>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2019 07:20 PM
here's my latest...this is working but it's showing the first option by default...need to have it be empty at first like a real Select Box variable...anyone see what I'm missing? I also need the variable to be mandatory.
<div class="form-group">
<label for="technology">What technology is this related to?</label>
<select id="technology" name="technology"
[(ngModel)]="technology" class="form-control">
<option value="1">Help Desk</option>
<option value="2">IT</option>
<option value="3">Payroll</option>
</select>
</div>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2019 08:14 PM
here's my latest...after remembering that a select box with "Include none" checked on the variable record will show "None" on load...so my script below is good. I just need to make the field mandatory, which would also mean it needs to not accept "None" as a choice. it's getting there though!
<div class="form-group">
<label for="technology">What technology is this related to?</label>
<select id="technology" name="technology"
[(ngModel)]="technology" class="form-control">
<option value="0">None</option>
<option value="1">Help Desk</option>
<option value="2">IT</option>
<option value="3">Payroll</option>
</select>
</div>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2019 08:37 PM
Try below code,
<div class="form-group">
<label for="technology">What technology is this related to?</label>
<select id="technology" name="technology"
ngModel="technology" class="form-control" required>
<option value="0">None</option>
<option value="1">Help Desk</option>
<option value="2">IT</option>
<option value="3">Payroll</option>
</select>
</div>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2019 09:25 PM
Hi Shweta, thanks for your response.
I tried your code...it is not making the field mandatory unfortunately, and I'm trying to verify if the data object for "technology" is passing back to the client script. here's my client script...the log to the console shows "undefined". Any thoughts on what's wrong?
function($scope) {
var c = this;
c.addItem = function(){
var tech = c.data.technology;
console.log('technology is '+tech);
c.server.update().then(function(response){
c.data = {};
})
}
}