vuejs model not updating when using an address lookup - vue.js

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

Related

How to get related value from SelectList

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.

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.

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!

Why Behat/Mink cant't find input field by ID, only by name?

I am testing page with behat and filling form.
I have two password inputs in page html.
First is on top:
<input id="login_password_0" class="form-control " type="password" placeholder="Slaptažodis" autocomplete="off" name="password">
Second at the bottom:
<input id="password" class="form-control validate" type="password" value="" name="password">
Then I run behat/mink test with:
And I fill in "password" with "test"
It fills first one and I need second to be filled.
How to understand documentation, that element can be found and filled by 'id|name|label|value'.
P.S. Changing HTML is not an option.
Haven't tested but it looks like that Behat is performing a task only once. He has no idea that there could be two elements with the same name. "Name" attribute should be unique for one form. Otherwise, you'll be posting two elements with the same name.
Without fixing your HTML nothing is possible, unless you implement your own test which overcomes this issue. Now "password" is both "id" and 2x "name" attribute. Selector should be unique.

How can I access extra customer registration form field values via the Bigcommerce API?

In the bigcommerce control panel, you are given the option to
add extra fields to the customer registration form.
This is shown in the control panel when Editing a customer record. They
show up, in the rendered html as this kind of thing:
<div class="field formRow ">
<label for="FormField_24"><span class="FormFieldLabel">FIELD NAME</span>
...
</label>
<div class="field-group value">
<input type="hidden" value="24" class="FormFieldId">
<input type="hidden" value="1" class="FormFieldFormId">
...
<input type="text" value="FIELD VALUE" class="field-xlarge FormField"
name="FormField[1][24]" id="FormField_24" ...>
</div>
</div>
However, walking the records with the Customer API doesn't show any of these extra fields.
Is there is anything in the Bigcommerce API that will let me access these custom customer form fields?
Update:
There are some older questions about this, that I didn't spot in searching (here, and here).
Given that those questions are from January & July last year, and still have no solution, it looks like this is simply a gap in the API. Damn.