zimnicki1127 Posted July 26, 2016 Share Posted July 26, 2016 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 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")); Link to comment Share on other sites More sharing options...
dsonesuk Posted July 26, 2016 Share Posted July 26, 2016 You should not need to add onclick javascript event to radio button using PHP, you should just add a identifier such as id or maybe a class, then use unobtrusive JavaScript to assign the required event to that identifier, its more practical manageable this way. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now