Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
eq in html form

 
Post new topic   Reply to topic    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
xeron
Smarty n00b


Joined: 29 Sep 2013
Posts: 2

PostPosted: Sun Sep 29, 2013 4:37 pm    Post subject: eq in html form Reply with quote

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
View user's profile Send private message
IT_Services
Smarty Rookie


Joined: 30 Sep 2013
Posts: 9

PostPosted: Mon Sep 30, 2013 7:42 am    Post subject: Reply with quote

What about this:

Code:
<option value="{$type}"{if $type eq $recordtype} selected="selected"{/if}>{$type}</option>
Back to top
View user's profile Send private message
xeron
Smarty n00b


Joined: 29 Sep 2013
Posts: 2

PostPosted: Mon Sep 30, 2013 9:56 am    Post subject: Reply with quote

Aah I knew it was something stupid I'm missing!

Thanks IT_Services!!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP