CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 retrieving RadioButton selected value. Codecharge Studio. PHP. MySql

Print topic Send  topic

Author Message
tonyk

Posts: 163
Posted: 03/27/2004, 6:03 AM

I posted this to the wrong section, hence this cross-post, sorry.

Hi,
Using CodeCharge Studio.
I am trying to retrieve the value from a set of 3 radiobuttons and then modify another field depending on the result. There appears only to be an 'onclick' event listed although there is mention of 'onchange' being effective in some Javascript sites that I have checked.
I have also seen that a set of radiobuttons can be regarded as the equivalent of a listbox.
When I use the onclick event with some test code it seems to do nothing and I found the code had been placed in the wrong part of the html code. I am happy to correct that manually if I have to. When the onclick event was built as a separate function still nothing happened as if the event had not fired.

In order to retrieve id of the selected radiobutton do I use 'getSelectedIndex' ? I have tried many things and am now rather frustrated and muddled!

Any help or a working example would be greatly appreciated.

Tony
View profile  Send private message
peterr


Posts: 5971
Posted: 03/27/2004, 11:14 AM

As for JavaScript, you can type your own JavaScript directly in HTML, without using CCS events. Therefore if you find JavaScript examples on the net you should be able to apply them directly in HTML.

However, I don't know what is getSelectedIndex but it doesn't look like JavaScript. Searching on Google shows that this may be a Flash or Java Applet function. Are you using Flash or Java Applets?
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
peterr


Posts: 5971
Posted: 03/27/2004, 12:07 PM

BTW, please see:
http://www.w3schools.com/js/tryit.asp?filename=tryjs_form_radio
(found here http://www.w3schools.com/js/js_form.asp)

This is a simple example that looks similar to what you tried to do.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
tonyk

Posts: 163
Posted: 03/27/2004, 8:47 PM

Dear Peter,
I have managed to find solutions and now have a functioning system that does what I wanted.

I added this to the html for the control
onclick="setvalueradio(this,ticket.stat_consent);"
and used this function to obtain the value and write it to another button further down the document.

function setvalueradio(radionx,targetx)
{
var rbresult;
with (radionx.form)
{
if (radionx.type == "radio")
{
rbresult = eval(radionx.value);
}
targetx[rbresult].checked=true;
}
}

targetx was in the format of formname.controlname

What I dont understand is why you have to use built functions for some things using the add code facility (for list boxes) and for radio buttons you embed the onclick event in the html... anyway it works!

Thanks for your advice and I will look at the sites you have mentioned.:-)

Tony

ps selectedIndex is used in the code to activate an iframe, I cant remember where I saw getSelectedIndex
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.