Creating radio buttons through an array in php(need to hide text box)

I am working on a project for my job. I have php that creates multiple radio button lists through an array. There are 6 categories that that a list of radio buttons for each of the categories. I am trying to add an onclick javascript function to just one of the radio buttons. There is a text box on the very bottom, I want that to only show up if a certain radio button is clicked. I know how to create this if the radio buttons were created in html, but not in php through arrays.

I have the code attached below

<?php
$form_fields = array(
    "id" => array(
        "bsc_id",
        "fname",
        "mname",
        "lname",
        "email",
        "grad_id",
        "major_id",
        "grad_date",
        "deg_id",
        "age_id",
        "ethn_id",
        "res_id",
        "assist_id",
        "assist_other"
    ) ,
    "name" => array(
        "Banner ID",
        "First Name",
        "Middle Name",
        "Last Name",
        "E-mail Address",
        "Status",
        "Major",
        "Graduation Date<br/>(mm-yyyy)",
        "Degree",
        "Age Group",
        "Ethnicity",
        "Residency",
        "Greatest Assistance",
        "If Assistance Other"
    ) ,
    "type" => array(
        "age_id" => "radio",
        "grad_id" => "radio",
        "major_id" => "select",
        "deg_id" => "radio",
        "ethn_id" => "radio",
        "grad_date" => "date",
        "res_id" => "checkbox",
        "assist_id" => "radio"
    ) ,
    "option" => array(
        "age_id" => "sql:select * from age_code",
        "grad_id" => "sql:select * from grad_code",
        "major_id" => "sql:select * from major_code ORDER BY    major_text",
        "deg_id" => "sql:select * from deg_code",
        "ethn_id" => "sql:select * from ethn_code",
        "grad_date" => "fields:m-Y",
        "res_id" => "sql:select * from res_code",
        "assist_id" => "sql:select * from assist_code"
    )
);

The end result of the PHP should be nothing more than HTML, so it should be no different to what you know.
This could probably be done without js, using the css only “Checkbox Hack”.
What does the resulting html from the php look like?

The problem i am having is adding the function. It wont regester if i add it like this:

“onclick” => array(“age_id” => “handlerFunction(this)”),

check the HTML source code in your browser. it might be that your PHP function does not do what you expect.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.