Text field not initialized with value

  • Paul Adamson
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 3 months ago #128061 by Paul Adamson
Text field not initialized with value was created by Paul Adamson
Hi Tuan, in this file:

/components/com_helpdeskpro/View/fieldlayout/text.php

the code
Code:
<input type="<?php echo $type; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value=""<?php echo $attributes; ?> />

never sets the value of the field, so when I display the form with a value preset, it is blank. I've corrected it in my version like this:
Code:
<input type="<?php echo $type; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo $value; ?>"<?php echo $attributes; ?> />

Cheers
Paul

Please Log in or Create an account to join the conversation.

More
5 years 3 months ago #128066 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Text field not initialized with value
Thanks Paul. To prevent xss attack, the code should be changed to:
Code:
<input type="<?php echo $type; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo htmlspecialchars($value, ENT_COMPAT, 'UTF-8'); ?>"<?php echo $attributes; ?> />

Regards,

Tuan
The following user(s) said Thank You: Paul Adamson

Please Log in or Create an account to join the conversation.

Moderators: Tuan Pham Ngoc