stikbizkit Posted June 21, 2010 Share Posted June 21, 2010 Ok folks here is the deal. After two weeks of researching and wracking my brain, I need help and fast. I have a contact form, PHP based and want to do the following: Patent Attorney Venture Capital Manager or Advisor Product Designer Manufacturer I Have A General Question Say, when I click patent attorney, a list of check boxes appear. When I check manufacturer, the patent attorney boxes disappear and the options for manufacturer appear. Attached are the forms. [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/205436-help-me-before-i-go-insane/ Share on other sites More sharing options...
kratsg Posted June 21, 2010 Share Posted June 21, 2010 It sounds to me like you want to use JavaScript+AJAX(for calling the checkboxes dynamically). Quote Link to comment https://forums.phpfreaks.com/topic/205436-help-me-before-i-go-insane/#findComment-1075081 Share on other sites More sharing options...
stikbizkit Posted June 21, 2010 Author Share Posted June 21, 2010 I suppose that would work, but I have no idea how to do so, I am horrible at programming :-\ Quote Link to comment https://forums.phpfreaks.com/topic/205436-help-me-before-i-go-insane/#findComment-1075083 Share on other sites More sharing options...
kratsg Posted June 21, 2010 Share Posted June 21, 2010 Well, while this "isn't" the board for it... here's a shot... You can create two checkbox groups and show one or the other: <script type='text/javascript'> function getCheckboxes(target){ var x = document.getElementsByClassName("checkboxes"); for(i=0;i<x.length;i++){ if(x[i].getAttribute('rel') == target){ x[i].style.display = 'inline'; } else { x[i].style.display = 'none'; } } } </script> <a href="#" onclick="getCheckboxes('patent');return false;">Patents</a> | <a href="#" onclick="getCheckboxes('manufacturer');return false;">Manufacturer</a> <form name="some_form"> <input type="checkbox" class="checkboxes" rel="patent" value="1" /> <input type="checkbox" class="checkboxes" rel="patent" value="2" /> <input type="checkbox" class="checkboxes" rel="patent" value="3" /> <input type="checkbox" class="checkboxes" rel="patent" value="4" /> <input type="checkbox" class="checkboxes" rel="patent" value="5" /> <input type="checkbox" class="checkboxes" rel="manufacturer" value="1" /> <input type="checkbox" class="checkboxes" rel="manufacturer" value="2" /> <input type="checkbox" class="checkboxes" rel="manufacturer" value="3" /> <input type="checkbox" class="checkboxes" rel="manufacturer" value="4" /> <input type="checkbox" class="checkboxes" rel="manufacturer" value="5" /> </form> <script type='text/javascript'> getCheckboxes("patent"); </script> Edit: Two typos, the above code works perfectly now. Quote Link to comment https://forums.phpfreaks.com/topic/205436-help-me-before-i-go-insane/#findComment-1075094 Share on other sites More sharing options...
stikbizkit Posted June 21, 2010 Author Share Posted June 21, 2010 I will definitely try it. What is the correct area I should post in ? I want to play by the rules Quote Link to comment https://forums.phpfreaks.com/topic/205436-help-me-before-i-go-insane/#findComment-1075096 Share on other sites More sharing options...
kratsg Posted June 21, 2010 Share Posted June 21, 2010 The JavaScript help section. Quote Link to comment https://forums.phpfreaks.com/topic/205436-help-me-before-i-go-insane/#findComment-1075098 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.