|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
xeron Smarty n00b
Joined: 29 Sep 2013 Posts: 2
|
Posted: Sun Sep 29, 2013 4:37 pm Post subject: eq in html form |
|
|
I'm trying to compare two values in a html form in order to set the field selected or not. However this is not working and I cannot find why. On static entries it is but on the smarty variable ({$recordtype}) it isn’t.
Code: | <td><select name="type[]">
{foreach from=$types item=type}
<option value="{$type}"{if $type eq "{$recordtype}"} selected="selected"{/if}>{$type}</option>
{/foreach}
</select></td> |
I did check if the {$recordtype} variable was set in the foreach loop. When entering this value in the form output it is shown like expected. Other values are also all set. I compared the variables manual and they to match.
What am I doing wrong here? |
|
Back to top |
|
IT_Services Smarty Rookie
Joined: 30 Sep 2013 Posts: 9
|
Posted: Mon Sep 30, 2013 7:42 am Post subject: |
|
|
What about this:
Code: | <option value="{$type}"{if $type eq $recordtype} selected="selected"{/if}>{$type}</option> |
|
|
Back to top |
|
xeron Smarty n00b
Joined: 29 Sep 2013 Posts: 2
|
Posted: Mon Sep 30, 2013 9:56 am Post subject: |
|
|
Aah I knew it was something stupid I'm missing!
Thanks IT_Services!! |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|