How to get related value from SelectList - asp.net-core

Using .NET 5.0 and Azure SQL
I am trying to figure out how to get a related value when I make a selection from a drop down list and pass that value to a hidden input field.
My select list (id="customer" is for the jQuery Chosen plugin):
<select id="customer" asp-for="Assignment.Retailer_ASM" class="form-control" asp-items="ViewBag.Retailer_ASM">
<option value="">--Customers--</option>
</select>
So when a user selects a customer from this list, there is a FK value that I want to pass into the hidden input, which is used for RLS.
<input type="hidden" asp-for="Assignment.RlsArea" value="What to put here?" class="form-control" />
The value would be like Assignment.Retailer_ASM.RegionID, an INT for the selected Retailer_ASM.

Related

vuejs model not updating when using an address lookup

I am using a postcode search service to populate address form fields.
When an address is selected, the form fields are populated correctly, i.e. town is in town field etc.
Problem is, it doesn't update the model.
<div class="form-group address">
<label for="postcodeFormField">Postcode *</label>
<input name="postcode" v-model="contact.postcode" type="text" class="form-control" id="postcodeFormField" placeholder="SW7 3RX" required>
</div>
If I manually type into the fields, it does update the model. But the address data which displays in the form fields after an address is selected, is not being reflected in the model.
Add a ref to the input i.e ref="postcodeFormField"
Hit a method on submit button #click="myMethod()"
In that method:this.$refs.postcodeFormField.dispatchEvent(new Event('input'));

How Can I add currency selector on WHMCS custom page?

I am trying to add a currency selector on one of my custom pages where I have displayed the product details.
I want to allow my visitor to change the default currency from this custom page and view the product pricing accordingly.
I have added this code in my custom.tpl
<input type="hidden" name="token" value="{$LANG.go}">
<select name="currency" onchange="submit()" class="form-control">
<option value="">Change Currency (A$ AUD)</option>
{foreach from=$currencies item=listcurr}
<option value="{$listcurr.id}"{if $listcurr.id == $currency.id} selected{/if}>{$listcurr.prefix} {$listcurr.code}</option>
{/foreach}
</select>
</form> ```
But it is not working, every time I select the currency from the dropdown, it refreshes the page. but nothing changes,
please guide what I am doing wrong.
Thanks in advance
Aqsa,
You can do this. You could update your form to either:
Perform a GET request, and add the currency=$id parameter to the URL ($id being the ID for the currency in tblcurrencies.
Or
When your form submits, handle the form input, and set the currency in the session variable:
use WHMCS\Session;
Session::set('currency', $id);
Again, where $id relates to tblcurrencies.id.
Bare in mind that the currency cannot be changed for existing users, and it is not recommended changing their currency after they have made any transactions to avoid accounting/calculation issues.

Angular not compatible with chrome

I have a dropdown list with two links in angular. it is working with firefox and not working with chrome. is there any compatible issues for angular with chrome?
<div id="SelectField">
<select class="form-control form-control-lg">
<option value="" selected disabled>Select to Deploy Product/Products</option>
<option (click)="Single()">Deploy Single Product</option>
<option (click)="Multiple()">Deploy Multiple Products</option>
</select>
</div>
It is working fine with firefox but in chrome its not activating when we select an option
You can use change event in select tag and set the value of first option as undefined and rest of the options with any string value inside [ngValue]="single".
Here single is a string value which is assigned to that option.
You have to check in the change event with if condition what is passed as a value based on that you can call your respective methods..
Make sure you have to use ngModel in the select and ngValue will be your selected option value

Geb: How to add new attribute and its value

I have an input element where I need to set one extra attribute and its value.
<input autocomplete="off" id="to_input" name="to" class="form-control arrival ui-autocomplete-input" placeholder="To" data-input-component="searchCondition" data-input-support="suggest" type="text">
I need to add the below attribute:
How can I do this in Geb?
To say a little more details, when I enter TPE in the input text box, some dropdown items appears and when I select one of them like
"Taipei, XXX.. (TPE)"
Than the new attributes are set automatically same as the picture above.
The only way to do it, is using JavaScript executor:
browser.driver.executeScript("your script")
And script using jquery will look like:
$('jquery-selector').attr('attribute-name', 'attribute-value');
Of course make sure to fill in your data in quotes!

DOJO: How to validate (required="true") selectOneMenu

How i can validate DOJO selectOneMenu (required="true") here is some dummy code.
<select required="true" missingMessage="Ooops! You forgot your gender!"
name="gender" id="gender" data-dojo-type="dijit/form/?">
<option disabled="true" value="">Select a Gender</option>
<option value="1">Male</option>
<option value="2">Female</option>
</select>
Dojo provide 3 type of combobox :
Select
It is simple combobox like select in HTML with no validation and not provide any search facility inside select options.
ComboBox
It is pure form of combobox and name as ComboBox again it will not provide any default validation but it provide search facility within its options.
FilteringSelect
It is an advance form of select have default facility of validation and search facility. And it also has property to take value as input tag take value in HTML.
In dojo you can also try custom validation which is provided inside dojox library.
I hope it will help you.