Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Value of a hidden tv does not change on multiple forms #21

Open
oleics opened this issue Jun 10, 2011 · 3 comments
Open

Value of a hidden tv does not change on multiple forms #21

oleics opened this issue Jun 10, 2011 · 3 comments

Comments

@oleics
Copy link

oleics commented Jun 10, 2011

I hope you know what i mean. If not, i can give more details.

@Bruno17
Copy link
Owner

Bruno17 commented Jun 12, 2011

I'm not sure. Can you explain it a bit more by an example?

@oleics
Copy link
Author

oleics commented Jun 12, 2011

Create two hidden TVs, one named 'hidden_value_1' with a value of '1', the other named 'hidden_value_2' with a value of '2'

Form Tabs JSON:

[{
"formname":"FormOne"
,"formtabs": [{
"caption":"FormOne"
,"fields": [{
"field":"hidden_value"
,"inputTV":"hidden_value_1"
}]
}]
},{
"formname":"FormTwo"
,"formtabs": [{
"caption":"FormTwo"
,"fields": [{
"field":"hidden_value"
,"inputTV":"hidden_value_1"
}]
}]
}]

Now, if i use 'FormTwo' to create an item, the value of 'hidden_value' is still '1', not '2'.

@Bruno17
Copy link
Owner

Bruno17 commented Jun 12, 2011

for this scenario you can add a new TV-type and use this for your hidden inputTv.
I named mine 'hidden_fixvalue'

hidden_fixvalue.php:

<?php
/**
 * @package modx
 * @subpackage processors.element.tv.renders.mgr.input
 */
$this->xpdo->lexicon->load('tv_widget');


return $this->xpdo->smarty->fetch('element/tv/renders/input/hidden_fixvalue.tpl');

hidden_fixvalue.tpl:

<input id="tv{$tv->id}" name="tv{$tv->id}" type="hidden" value="{$tv->get('default_text')|escape}"" />

this will allways use the default-value of the TV, not the one which was sended with the request, what the default hidden-field does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants