WHMCS Remove "Country" selector from checkout page - field

i work on WHMCS customizations, and want to hide Contry selector field. I tryed to comment county from template, and field are not shown, but when try to checkout, i got this error:
Please correct the following errors before continuing:
Please choose your country from the drop down box
This is Code from template that handle that part:
<div class="col-sm-12">
<div class="form-group prepend-icon">
<label for="inputCountry" class="field-icon" id="inputCountryIcon">
<i class="fa fa-globe"></i>
</label>
<select name="country" id="inputCountry" class="field"{if $loggedin} disabled="disabled"{/if}>
{foreach $countries as $countrycode => $countrylabel}
<option value="{$countrycode}"{if (!$country && $countrycode == $defaultcountry) || $countrycode eq $country} selected{/if}>
{$countrylabel}
</option>
{/foreach}
</select>
</div>
</div>
and also this one:
<div class="col-sm-12">
<div class="form-group prepend-icon">
<select name="domaincontactcountry" id="inputDCCountry" class="field">
{foreach $countries as $countrycode => $countrylabel}
<option value="{$countrycode}"{if (!$domaincontact.country && $countrycode == $defaultcountry) || $countrycode eq $domaincontact.country} selected{/if}>
{$countrylabel}
</option>
{/foreach}
</select>
</div>
</div>
</div>
So my question is how to proceed with checkout without that warning?

For each country div add style="display:none", e.g.:
This will hide the div but will keep default country selection.

Related

Materialize CSS text input -> Getting a space between input and underline

I'm getting an extra line-feed in the textarea widget between the underline and the input area.
Here's what I'm getting:
You can see the extra space below the default text and the line for the widget
My code is pretty straight-forward I think:
<div class="row">
<div class="input-field col m4">
<i class="material-icons prefix">linear_scale</i>
<textarea id="r1-value" class="materialize-textarea"></textarea>
<label for="r1-value">R1 Value</label>
</div>
<div class=col m4">
<select class="browser-default" name="r1-units">
<option value="1">&#8486</option>
<option value="2">k&#8486</option>
<option value="3">M&#8486</option>
</select>
<label>Resistor Units</label>
</div>
</div>
<div class="row">
<div class="input-field col m4">
<i class="material-icons prefix">linear_scale</i>
<textarea id="r2-value" class="materialize-textarea"></textarea>
<label for="r2-value">R2 Value</label>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
$('select').formSelect();
});
</script>
Anyone have any idea what could be causing this?

ng-model not working for certain attributes in angularJS

Hi I encountered a problem with ng-model. I want to create an edit page for admin user to edit the rest of the user's permission level.
So, I listed out all the user's attributes in the edit page, and these attributes should display the current values.
I can update all the attributes correctly, however, the problem is that when visiting the edit page, only certain attributes are displayed while some are not. I think it is the problem with ng-model.
code snippets from my _form.html.erb
<div class="col-md-12 space-1" ng-class="{ 'has-error' : form['email'].$invalid }">
<label class="control-label">Email</label>
<div class="input-icon right">
<i ng-show="form['email'].$invalid" class="fa fa-warning tooltips" data-original-title="{{errors['email']}}" data-container="body"></i>
<input ng-model= "user.email" name="email" type="text" class="form-control">
</div>
</div>
<br>
<div class="col-md-12 space-1" ng-class="{ 'has-error' : form['events'].$invalid }">
<label class="control-label">Event Permission Level : {{user.activities.events}}</label>
<div class="input-icon right">
<i ng-show="form['events'].$invalid" class="fa fa-warning tooltips" data-original-title="{{errors['events']}}" data-container="body"></i>
<input ng-model= "user.activities.events" name="activities.events" type="range" max="2" min="0" class="form-control">
</div>
</div>
<br>
<div class="col-md-12 space-1" ng-class="{ 'has-error' : form['admin_events'].$invalid }">
<label class="control-label">Admin Event Permission Level : {{user.activities.admin_events}}</label>
<div class="input-icon right">
<i ng-show="form['admin_events'].$invalid" class="fa fa-warning tooltips" data-original-title="{{errors['admin_events']}}" data-container="body"></i>
<input ng-model= "user.activities.admin_events" name="activities.admin_events" type="range" max="2" min="0" class="form-control">
</div>
</div>
<br>
The code above shows 3 different ng-models, 1.user.email, 2.user.activities.events 3.user.activities.admin_events
The way I process them is the same, but when visiting the edit page, only email and events attributes displayed the current value, but not admin_events. I can update their values alright, but I cannot get admin_events to display its current value when visiting the edit page. This is weird isn't it. I mean if I can see the value of events, why can't I see the value of admin_event since they all belong to the user variable.
Can anyone explain why is it like this? It is very confusing for me. Thank you very much.
As it solved the problem, I quote myself from the comments :
If only user.activities.admin_events is not working, it may be related to the _ notation. Try camel case user.activities.adminEvents or user.activities['admin_events'].

Populate select tag after selecting another select tag rails

i have model Store, that has State, City and Neighborhood fields.
i've made an advanced search with searchkick,
but now i want to populate City select_tag with Cities from Stores that has State == State selected in State select tag..
i found grouped_collection, but i dont have a separeted state and city table, just state and city fields in my Store model..
there is any way to make this happen?
ps: sorry for bad english, hope you guys understand
<div class="col-sm-3 col-md-3">
<div class="form-group">
<select class="form-control" name="state" id="state" title="Select Category">
<%= #states.each do |selectstate| %>
<option value="<%= selectstate.state%>"><%= selectstate.state%></option>
<%end%>
</select>
</div><!-- /.form-group -->
</div><!-- /.col-* -->
<div class="col-sm-3 col-md-3">
<div class="form-group">
<select class="form-control" name="state" id="state" title="Select Category">
<%= #cities.each do |selectcity| %>
<option value="<%= selectcity.city%>"><%= selectcity.city%></option>
<%end%>
</select>
</div><!-- /.form-group -->
</div><!-- /.col-* -->
.
def index
search = params[:search].presence || "*"
conditions = {}
conditions[:state] = params[:state] if params[:state].present?
conditions[:city] = params[:city] if params[:city].present?
conditions[:neighborhood] = params[:neighborhood] if params[:neighborhood].present?
#stores = Store.search search, where: conditions, aggs: [:city, :state, :neighborhood], smart_aggs: false
#states = Store.select("DISTINCT(STATE)")
#cities = Store.select("DISTINCT(CITY)")
#neighborhoods = Store.select("DISTINCT(NEIGHBORHOOD)")
end

Select option for Ruby on Rails

I have sign up form. how can I make select and option form for '<%=' format. can you please help me.
<%= form_for(#patient, url: signup_path, :html => {class: 'register-form', :style => "display: inherit"}) do |f| %>
<div class="form-group">
<label class="control-label visible-ie8 visible-ie9">İsim</label>
<div class="input-icon">
<i class="fa fa-font"></i>
<%= f.text_field :name, class: 'form-control placeholder-no-fix', :placeholder => "İsim" %>
</div>
</div>
<div class="form-group">
<label class="control-label visible-ie8 visible-ie9">Ülke</label>
<select name="country" id="select2_sample4" class="select2 form-control">
<option value="">Ülke Seçiniz...</option>
<option value="Türkiye">Türkiye</option>
<option value="Afganistan">Afghanistan</option>
<option value="Albania">Albania</option>
<option value="Algeria">Algeria</option>
<option value="American Samoa">American Samoa</option>
<option value="Andorra">Andorra</option>
<option value="Angola">Angola</option>
</select>
</div>
<button type="submit" id="register-submit-btn" class="btn green-haze pull-right"> Kayıt ol </button>
Your question is kind of vague; however, I think I get what you're asking. It looks like your data for the select field is static, so you may try it like this:
Then use the following instead of the HTML you have there:
<%= select_tag(:country, options_for_select([['Select Country', '0'], ['Albania', 'Albania']], '0'))%>
This will generate the following:
<select name="country" id="country">
<option value="0" selected="selected">Select Country</option>
<option value="Albania">Albania</option>
</select>
If you wanted to have a different default selected, just specify it at the end. For example:
<%= select_tag(:country, options_for_select([['Select Country', '0'], ['Albania', 'Albania']], 'Albania'))%>
Generates:
<select name="country" id="country">
<option value="0">Select Country</option>
<option selected = "selected" value="Albania">Albania</option>
</select>
Hope that helps.

Click on element with capybara

I have a yes/no slider on a web page that i need to interact with. I need to click on one of the elements so that the value changes from true to false or false to true. Using the id i can get the value of the element with
find_field('passcode_policies__allow_simple').find('option[selected]').value
But i have tried over and over to simulate a click on this object to change the value and have been unsuccessful.
<div class="control-group">
<select class="toggle" id="passcode_policies__allow_simple" name="passcode_policies[][allow_simple]" style="display: none; " tabindex="-1">
<option value="true" selected="selected">Yes</option>
<option value="false">No</option>
</select>
<div class="ui-switch off" tabindex="0">
<div class="ui-switch-mask">
<div class="ui-switch-master" style="left: -38px; ">
<div class="ui-switch-upper">
<span class="ui-switch-handle" style="left: 33px; "></span>
</div>
<div class="ui-switch-lower">
<div class="ui-switch-labels">
Yes
No
</div>
</div>
</div>
</div>
<div class="ui-switch-middle" style="width: 60px; ">
</div>
</div>
<label class="inline">Allow simple value</label>
<span class="help-block">Permit the use of repeating, ascending, and descending character sequences</span>
</div>
If you're using Selenium, headless webkit or phantomjs (poltergeist gem) you should be able to call the simple
click_link 'Yes'
but if you're just using straight up capybara you will have to interact with the select element with something like
select('Yes', :from => 'passcode_policies__allow_simple')
and you can check the visibility and whatnot with this capybara: page.should have_no_content doesn't work correctly for display:none element
Working solution:
within(:css, '#passcode_policies__allow_simple + .ui-switch') do
click_link 'No'
end

Resources