Note that there are some explanatory texts on larger screens.

plurals
  1. POCountry drop down list output to view
    text
    copied!<p>I have a Country list helper implemented just fine and can select quite happily.</p> <p>The one thing I am trying to work out now is how to output the selected country to view...</p> <p>Sample of the helper:</p> <pre><code>class CountryListHelper extends FormHelper { var $helpers = array('Form'); function select($fieldname) { $list = $this-&gt;Form-&gt;input($fieldname , array( 'type' =&gt; 'select', 'label' =&gt; 'Country of Residence', 'options' =&gt; array( '' =&gt; 'Please select a country', 'AF' =&gt; 'Afganistan', 'AL' =&gt; 'Albania', 'DZ' =&gt; 'Algeria', 'AS' =&gt; 'American Samoa', 'AD' =&gt; 'Andorra', 'AO' =&gt; 'Angola', 'AI' =&gt; 'Anguilla', 'AQ' =&gt; 'Antarctica', </code></pre> <p>code in the edit and add view:</p> <pre><code>echo $this-&gt;CountryList-&gt;select('country'); </code></pre> <p>The data being stored is only the acronym (as shown in the helper code snippet) and this is what is being output to view.ctp (AF for example). Is there a way to do a retrieval from the helper to match the full country name to the acronym and push it to view.ctp?</p> <p>Snippet from view.ctp which I am trying to modify to display the full country name as apposed to just the acronym.</p> <pre><code>&lt;dt&lt;?php if ($i % 2 == 0) echo $class;?&gt;&gt;&lt;?php __('Country of Residence'); ?&gt;&lt;/dt&gt; &lt;dd&lt;?php if ($i++ % 2 == 0) echo $class;?&gt;&gt; &lt;?php echo $user['User']['country']; ?&gt; &amp;nbsp; &lt;/dd&gt; </code></pre> <p>Many thanks in advance!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload