php - Why the JavaScript result always return first value? -


Here's my problem: I'm currently trying to customize Joomla content with some modules. As I am trying to hide some devices before the user clicks on the input. Let's say that the user says that test 1 click which is a radio button, then another field that I hide from the developer, will be displayed in test1's contents all the details are loaded from mysql database.

This is my javascript code that I am trying to show values. But it always shows value to me first, though I have to click on other value as Test 2 or Test 3.

Example:

  & lt; script type = "text / javascript" & gt; Function showbox 1 () {document.getElementById ('hidebox1'). Style.display = ""; var test = document.getElementById ('123'). value; Confirmation (testing); & Lt; / Script & gt;   

Here is my PHP code:

   QuoteName ('campusid')); $ Query-> From ($ db-> quoteName ('campus')); $ Query-> Where ($ db-> quoteName ('college'). '='. $ Db-> Bid ('1')); // $ db-> Set query for DB oject to execute setQuery ($ query); // Obtain DB objects to load results as a list of objects $ results = $ db- & gt; LoadObjectList (); If ($ result) {foreach ($ result as result result) {echo "and label class = 'option block spacer-t 10'>; Echo "& lt; input type = 'radio' name = '$ result- & gt; campus id' = '123' value = '$ result-> composited' onClick = 'return showBox1 ()' & gt; Lt; span class = 'radio' & gt; & lt; / span & gt; "; Sampling Results $ & gt; Campus; Echo '& lt; / label & gt; '; }} And {echo 'error';}? & Gt;   

As an example, the output for the first device is 3 radio buttons, each radio button has its own value. When the user clicks on 1 from the radio button, then the correct value should be shown so that I can assume in my next database to select my database data. Is there any mistake I made on my code which is always getting the first value, though I click the other radio button?

is similar to your radiobuttons id 123. You are choosing from the element DOM

HTML:

/ P> Pre> onClick = 'return showBox1 (this)'

JavaScript

  function showBox1 (element) {confirmation} (element.value); }    

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -