Text field not initialized with value

  • Paul Adamson
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
1 week 4 days 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
<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:
<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
1 week 3 days 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:
<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