|
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 |
strafford Smarty Rookie
Joined: 27 Jun 2018 Posts: 17
|
Posted: Wed Jun 27, 2018 6:18 pm Post subject: how to assign/overwrite the value of an input in template |
|
|
I have a template, with an input, added via QuickForms $tpl->addElement. Later on, I would like to (from php) be able to overwrite the value of the input - is this possible?
I know I can assign a variable, but not sure how I can access the tpl structure to write a new value.
Added input: Code: | $form->addElement('text', 'fdatefrom', gettext("Date From"). ':', ' id=fdatefrom size=10 maxlength=10 value="' . $fdatefrom. '"'. $selectclass);
|
Then later, I would like to be able to change that value in the template object
(which seems to be in $tpl --> _tpl_vars --> form_data -- fdatefrom["value"]) |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
|
Back to top |
|
strafford Smarty Rookie
Joined: 27 Jun 2018 Posts: 17
|
Posted: Thu Jun 28, 2018 3:59 pm Post subject: |
|
|
I am using a template variable to display everything.
As for your reference to https://www.smarty.net/docs/en/api.get.template.vars.tpl yes I can get the values, but I want to then assign/change the values. That is the part I cannot figure out. |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Thu Jun 28, 2018 4:02 pm Post subject: |
|
|
Just assign a new value to the template.
Until you fetch the template content, it's all fair game. |
|
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
|