Code: Select all
function set_val(text_val){
var inputtext = document.getElementById("my_id");
inputtext.value=text_val;
}
Code: Select all
function set_val(text_val){
var inputtext = document.getElementById("my_id");
inputtext.value=text_val;
}
Then you can use getElementByName in JavaScript:$this->CreateInputText('','my_name')
If you delete $id you will miss the value of the field in $params array on the next page, but you may find it in $this->smarty->params array.var inputtext = document.getElementByName("my_name");
Code: Select all
function CreateInputText($id, $name, $value='', $size='10', $maxlength='255', $addttext='', $generate_id=true)
{
$this->LoadFormMethods();
return cms_module_CreateInputText($this, $id, $name, $value, $size, $maxlength, $addttext, $generate_id);
}
Code: Select all
function cms_module_CreateInputText(&$modinstance, $id, $name, $value='', $size='10', $maxlength='255', $addttext='', $generate_id=true)
{
$value = str_replace('"', '"', $value);
$text = '<input type="text" name="'.$id.$name.'"';
if ($generate_id)
{
$text .= ' id="'.$id.$name.'"';
}
$text .= ' value="'.$value.'" size="'.$size.'" maxlength="'.$maxlength.'"';
if ($addttext != '')
{
$text .= ' ' . $addttext;
}
$text .= " />\n";
return $text;
}
Code: Select all
$this->smarty->assign('to_user', $this->CreateInputText($id, 'user_login', isset($params['user_login']) ? $params['user_login'] : '', '10', '255', 'class="" id="login_input"', false));
Probably you can make your js-code dynamic. Pass $id to template as smarty variable and then generate js:piotrekkr wrote: I need this value in my $params
Code: Select all
function set_val(text_val){
var inputtext = document.getElementById("{$inputid}my_id");
inputtext.value=text_val;
}
And the value is in $params on the next page?piotrekkr wrote: It worked perfectlyI'm usig it like that:
It has only last param as false so the id param isn't generated and I added it manualy using $addtext param in CreateInputText function.Code: Select all
$this->smarty->assign('to_user', $this->CreateInputText($id, 'user_login', isset($params['user_login']) ? $params['user_login'] : '', '10', '255', 'class="" id="login_input"', false));
It's the same as it was before changes. I changed only id="something" param it is only important for js. I didn't changed name param generation... look at function that I've changed few posts before.Sonya wrote:And the value is in $params on the next page?piotrekkr wrote: It worked perfectlyI'm usig it like that:
It has only last param as false so the id param isn't generated and I added it manualy using $addtext param in CreateInputText function.Code: Select all
$this->smarty->assign('to_user', $this->CreateInputText($id, 'user_login', isset($params['user_login']) ? $params['user_login'] : '', '10', '255', 'class="" id="login_input"', false));
![]()
Code: Select all
array(6) { ["returnid"]=> string(3) "104" ["user_login"]=> string(8) "student3" ["title"]=> string(8) "sdhjhjsd" ["content"]=> string(20) "jksakjsajksakjsaksaj" ["submit"]=> string(7) "Wyślij" ["action"]=> string(12) "send_message" }
Probably, until you update your cms installtionpiotrekkr wrote: I have made already few changes in core and it worked for me.
It's open source. Share your knowledge. What have you find out about $inline or $returnid? Write it down, suggest for documentation http://forum.cmsmadesimple.org/index.ph ... ,16.0.html or do not complainpiotrekkr wrote: I don't know where id param is used. Params in class.Module.php are poor documented and documentation says nothing for example abaut $id param (how it work and what for is he important etc) or $returnid or how works $inline params in link rendering functions... After half a year I understanded how they works... It should be written in documentation somewhere...