|
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 |
a3653171 Smarty n00b
Joined: 14 May 2014 Posts: 1
|
Posted: Wed May 14, 2014 11:44 am Post subject: Dynamically Name Text Field |
|
|
I'm modifying a time tracker application to be able to input the time differently. The way it was originally setup was so that the user could only input time for one project and one day at a time. I would like to be able to have the user be able to input the time for every project and every day of the week at once.
I've changed the input layout to accommodate what I would like to do.
This is what the layout looked like originally. The user would select the project from the drop down, input the hours for that project for the selected day and submit it.
This is how I have changed it. The user sees all their assigned projects at once and is able to input all their hours for each project for each day of the week and submit it all at once.
I am trying to name each duration input text field dynamically to tie it to the project it is for to be able to input the time for that project. I am having trouble doing this as I have not worked with Smarty before this and need help with how to proceed with doing this.
This is the code I have so far.
time.php
Code: | if ((TYPE_DURATION == $user->record_type) || (TYPE_ALL == $user->record_type))
$form->addInput(array('type'=>'textfield','size'=>'2','name'=>'durationSun','value'=>$cl_durationSun));
$form->addInput(array('type'=>'textfield','size'=>'2','name'=>'durationMon','value'=>$cl_durationMon));
$form->addInput(array('type'=>'textfield','size'=>'2','name'=>'durationTue','value'=>$cl_durationTue));
$form->addInput(array('type'=>'textfield','size'=>'2','name'=>'durationWed','value'=>$cl_durationWed));
$form->addInput(array('type'=>'textfield','size'=>'2','name'=>'durationThu','value'=>$cl_durationThu));
$form->addInput(array('type'=>'textfield','size'=>'2','name'=>'durationFri','value'=>$cl_durationFri));
$form->addInput(array('type'=>'textfield','size'=>'2','name'=>'durationSat','value'=>$cl_durationSat)); |
time.tpl
Code: | {if ($smarty.const.MODE_PROJECTS == $user->tracking_mode || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)}
<tr>
<td> </td>
<th scope="col">S</th>
<th scope="col">M</th>
<th scope="col">T</th>
<th scope="col">W</th>
<th scope="col">T</th>
<th scope="col">F</th>
<th scope="col">S</th>
</tr>
{foreach $active_projects as $project}
<tr>
<td>{$project.name}</td>
<td>{$forms.timeRecordForm.durationSun.control}</td>
<td>{$forms.timeRecordForm.durationMon.control}</td>
<td>{$forms.timeRecordForm.durationTue.control}</td>
<td>{$forms.timeRecordForm.durationWed.control}</td>
<td>{$forms.timeRecordForm.durationThu.control}</td>
<td>{$forms.timeRecordForm.durationFri.control}</td>
<td>{$forms.timeRecordForm.durationSat.control}</td>
</tr>
{/foreach}
{/if} |
|
|
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
|