Opened 1 year ago

Last updated 1 year ago

Custom field value not stored (Ticket #209)

Reported by harry
Assigned to Jack
Type Defect
Priority Normal
Severity Normal
Component Tickets
Milestone 2.2
Version 2.1.1
Status Invalid
Percent 0%

Description

What did you do to cause this?

Create custom field “Reproducibility” with this code

<select name=“reproducibility”>
<option value=“1”></option>
<option value=“2”>Yes</option>
<option value=“3”>No</option>
</select>

What page were you on?

Tickets

Describe the defect:

New Ticket page shows the custom field with name and selection as expected, but after creating a new ticket, the selected custom field value is missing in Tickets page.

Attachments

Ticket History

1 year and 1 month ago by Jack

If you need further help, the forums are a better choice as this place is setup for actual issues, not discussion and help.

1 year and 1 month ago by Jack

  • Closed ticket as Invalid

You may need to type it in yourself if copy/pasting isn’t working.

1 year and 1 month ago by harry

  • Reopened ticket as Reopened

Thanks for the reply Jack. I try your code in my 2.1.1 intallation, values are still not saved. What else I did wrong?

Code entered:
<select name=‘pct’><?php foreach(array(0,25,50,75,100) as $_pct) { ?><option value=’<?php echo $_pct; ?>’<?php echo (is_array($ticket) && $ticket[‘extra’][$field[‘id’]] == $_pct.’‘ ? ‘selected=“selected”’ : ‘’); ?>><?php echo $_pct; ?>%</option><?php } ?></select>

Step into \templates\traq.templates\new_ticket.php (line 115), the code was translated to:
<select name=‘pct’><?php foreach(array(0,25,50,75,100) as \$_pct) { ?><option value=’<?php echo \$_pct; ?>’<?php echo (is_array(\$ticket) && \$ticket[‘extra’][\$field[‘id’]] == \$_pct.’‘ ? ‘selected=\“selected\”’ : ‘’); ?>><?php echo \$_pct; ?>%</option><?php } ?></select>

Is that something in my PHP setting?

1 year and 2 months ago by Jack

  • Closed ticket as Invalid

1 year and 2 months ago by Jack

Here’s the code for the percent field used here on the site.

<select name=”name“>
<?php foreach(array(‘0’,‘10’,‘20’,‘30’,‘40’,‘50’,‘60’,‘70’,‘80’,‘90’,‘100’) as $_pct) { ?> <option value=”<?php echo $_pct; ?>“ <?php echo (is_array($ticket) && @$ticket[‘extra’][$field[‘id’]] == $_pct.’‘ ? ‘selected=\“selected\”’ : ‘’); ?>><?php echo $_pct; ?>%</option>
<?php } ?>
</select>

1 year and 2 months ago by Jack

  • Changed Priority from High to Normal
  • Changed Severity from Major to Normal

The field is not being remembered because you need to add the checking of that yourself.

1 year and 2 months ago by harry

  • Opened Ticket