paperweight Posted May 18, 2016 Share Posted May 18, 2016 In the Modern orderform, is there a way to make the "Country" optional in viewcart.tpl? I am trying to force a hidden choice for users in this way: <select name="country" id="country" value="US" selected="selected"> But that still shows an error message: Please choose your country from the drop down box If there is no way to make Country optional, is there a way I can make a hidden selection for the user? Link to comment Share on other sites More sharing options...
sentq Posted May 18, 2016 Share Posted May 18, 2016 this is how you have to make it <input type="hidden" name="country" value="US"> but you will need to change countries select element name to something else, so it will not override/conflict with the hidden value Link to comment Share on other sites More sharing options...
paperweight Posted May 18, 2016 Author Share Posted May 18, 2016 Thanks for your advice. What happens if I just delete that entire block: <label for="country" class="control-label">{$LANG.clientareacountry}</label> <select id="country" name="country" class="form-control"> {foreach from=$countries key=thisCountryCode item=thisCountryName} <option value="{$thisCountryCode}" {if $thisCountryCode eq $clientsdetails.country}selected="selected"{/if}>{$thisCountryName}</option> {/foreach} </select> If I delete that block and use <input type="hidden" name="country" value="US"> it still says I need to make a selection. So then I try to force it like <input type="hidden" name="country" value="US" selected> but it still says I need to make a selection. Is this what you mean? Link to comment Share on other sites More sharing options...
paperweight Posted May 18, 2016 Author Share Posted May 18, 2016 Ok I solved it. A pain in the butt. I've been using WHMCS for 4+ years and I remember 4 years ago having this same issue with "Country" not being optional.... why take so long to make this optional? Here's how I solved it by removing some code and changing things around: <!--<select id="country" name="country" class="form-control"> <option value="US" selected="selected">United States</option> </select>--> <input type="hidden" name="country" value="US"> Link to comment Share on other sites More sharing options...
drmtr Posted March 1, 2018 Share Posted March 1, 2018 On 5/18/2016 at 10:00 AM, paperweight said: Ok I solved it. A pain in the butt. I've been using WHMCS for 4+ years and I remember 4 years ago having this same issue with "Country" not being optional.... why take so long to make this optional? Here's how I solved it by removing some code and changing things around: <!--<select id="country" name="country" class="form-control"> <option value="US" selected="selected">United States</option> </select>--> <input type="hidden" name="country" value="US"> Hi can you tell me what is that other things you do, because when i apply this make me mess in template. Link to comment Share on other sites More sharing options...
Recommended Posts