strip_tags on select options

strip_tags on select options

peterbrownepeterbrowne Posts: 314Questions: 54Answers: 0

I have a select in the editor where the options in the select contain HTML tags. I want to remove those tags for the select and retain them for the records in the database. Is there a way to do this in the editor, such as using PHP strip_tags?

{
    label: "Program Outcomes:",
    name: "program_outcome[].program_outcome_pk",
    type: "select",
    placeholder: 'No selection',
    placeholderDisabled: false,
    placeholderValue: 0,
    multiple: true
                }

This question has an accepted answers - jump to answer

Answers

  • rf1234rf1234 Posts: 2,991Questions: 87Answers: 421
    Answer ✓

    https://css-tricks.com/snippets/javascript/strip-html-tags-in-javascript/

    And for the rest of the work you already have an answer from me, I guess. The event to use is "xhr"

    https://datatables.net/forums/discussion/comment/167249/#Comment_167249

  • peterbrownepeterbrowne Posts: 314Questions: 54Answers: 0

    Thanks, I used your server side option:

     ->join(
            Mjoin::inst( 'program_outcome' )
                ->link( 'unit_outcome.unit_outcome_pk', 'program_outcome_unit_outcome_lookup.unit_outcome_fk' )
                ->link( 'program_outcome.program_outcome_pk', 'program_outcome_unit_outcome_lookup.program_outcome_fk' )
                ->order( 'program_outcome.program_outcome asc' )
                ->fields(
                    Field::inst( 'program_outcome_pk' )
                        ->options( Options::inst()
                            ->table( 'program_outcome' )
                            ->value( 'program_outcome_pk' )
                            ->label( 'program_outcome' )
                            ->render( function ( $row ) {
                return strip_tags($row['program_outcome']);
            } )
                        ),
                    Field::inst( 'program_outcome' )
                )
        )
        ->process($_POST)
        ->json();
    
This discussion has been closed.