Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Smarty Query

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty Development
View previous topic :: View next topic  
Author Message
sandipray
Smarty n00b


Joined: 12 Aug 2013
Posts: 1

PostPosted: Mon Aug 12, 2013 2:00 pm    Post subject: Smarty Query Reply with quote

Code:
[code]I have included 3 checkboxes in EditViewUI.tpl using the following code :

{elseif $fldname eq 'cf_644' || $fldname eq 'cf_645' || $fldname eq 'cf_646' || $fldname eq 'cf_647' || $fldname eq 'cf_648' || $fldname eq 'cf_649' || $fldname eq 'cf_650' || $fldname eq 'cf_651' || $fldname eq 'cf_652'}
<div style="float:left">
<textarea class="detailedViewTextBox" style = "width:100%;" tabindex="{$vt_tab}" onFocus="this.className='detailedViewTextBoxOn'" name="{$fldname}" onBlur="this.className='detailedViewTextBox'" cols="90" rows="8">{$fldvalue}</textarea>
{if $fldlabel eq $MOD.Solution}
<input type = "hidden" name="helpdesk_solution" value = '{$fldvalue}'>
{/if}
</div>
<div style="float:left;">
&nbsp;&nbsp;&nbsp;
<label><b>Options:</b></label><br/>&nbsp;&nbsp;&nbsp;
<input type="checkbox" id="{$fldname}_1" name="{$fldname}_1" [b]value="1"[/b]/>
<label forname="{$fldname}_1">[b]Yes/No[/b]</label>
<br/>&nbsp;&nbsp;&nbsp;
<input type="checkbox" id="{$fldname}_2" name="{$fldname}_2" [b]value="1"[/b]/>
<label forname="{$fldname}_2">[b]Enter Value[/b]</label>
<br/>&nbsp;&nbsp;&nbsp;
<input type="checkbox" id="{$fldname}_3" name="{$fldname}_3" [b]value="1"[/b]/>
<label forname="{$fldname}_3">[b]Comments[/b]</label>
</div>

Now I want the value of the checkboxes (that are bolded) on the DetailViewUI.tpl when they are checked.
I am totally new in smarty,tried couple of times in various ways but failed.Please help.[code][/code][/code]
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Mon Aug 12, 2013 2:07 pm    Post subject: Reply with quote

It would probably be easiest to name the checkboxes all the same:

Code:
<input type="checkbox" name="{$fldname}[]" value="1">
<input type="checkbox" name="{$fldname}[]" value="2">
<input type="checkbox" name="{$fldname}[]" value="3">


Now when the form submits, check the array contents of $_POST[$fldname]

There is also a smarty plugin for checkboxes you might look at.

http://www.smarty.net/docs/en/language.function.html.checkboxes.tpl
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty Development 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