Wrox Programmer Forums
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 25th, 2005, 08:10 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default enabling the radio button

I have a asp page 'netfare.asp'

Heres APS code:

<%
 Set rsShowPub = con.Execute("select show_pub from company where company_id = '"& companyid &"'")
 if (not rsShowPub.Eof) then
 if rsShowPub("show_pub") then
%>
<br>
    <a name="loading2"><center><p><b>Loading Published Fares Please Wait...</b></p></center></a>

_______________________________________

I want this radio button:

<input type="radio" name="out" onclick="javascript: oSeg('<%=depFareID%>','<%=depContractID%>','<%=rsC ont("air_cds")%>','<%=invalidClass%>', '<% if ConFlag = false and preisdirect = true then response.write via& ",*" & ",*" else response.write "*" end if%>','<%=preisdirect%>','<% if preisdirect = true then response.write preaddoncost else response.write "*" end if%>','<%= pre_addonRBD %>','<%= pre_addonCD %>','<%= conFlag %>');"/>

________________________________________________

to be disabled until the loading of Published Fares is complete. How is this done?

The published fares table is populated with XML data and database data (i think). How can I wait until the table is fully populated (i.e all records have came back) - before enabling the radio button.

Thanks.

Picco

www.crmpicco.co.uk
__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk
 
Old February 25th, 2005, 08:21 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

You add DISABLED to the radio button. You add an onload handler that enables it. If there is only one radio button named out then:
Code:
function init()
{
  document.forms[0].elements["out"].disabled = false;
}
<body onload="init();" ....>
<input type="radio" name="out" DISABLED ...>
--

Joe (Microsoft MVP - XML)
 
Old February 25th, 2005, 08:56 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

The Radio button:

<input type="radio" name="out" onclick="javascript: oSeg('<%=depFareID%>','<%=depContractID%>','<%=rsC ont("air_cds")%>','<%=invalidClass%>', '<% if ConFlag = false and preisdirect = true then response.write via& ",*" & ",*" else response.write "*" end if%>','<%=preisdirect%>','<% if preisdirect = true then response.write preaddoncost else response.write "*" end if%>','<%= pre_addonRBD %>','<%= pre_addonCD %>','<%= conFlag %>');" DISABLED/>

Body tag:

<body bgcolor="#F5F5F5" onLoad="InitializeTimer();init();">

Javascript:

function init()
{
  document.forms[0].elements["out"].disabled = false;
}

is that correct?

www.crmpicco.co.uk
 
Old February 25th, 2005, 10:03 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Yes, with two caveats. Your radio button has to be in the first, or only, form on the page, secondly you should remove the closing slash:
Code:
...'<%= conFlag %>');"/>
to
Code:
...'<%= conFlag %>');">
A cleaner way would be:
Code:
function init()
{
  InitializeTimer();
  document.forms[0].elements["out"].disabled = false;
}

<body bgcolor="#F5F5F5" onLoad="init();">

--

Joe (Microsoft MVP - XML)
 
Old February 25th, 2005, 10:11 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

what are caveats?

www.crmpicco.co.uk
 
Old February 25th, 2005, 10:18 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Quote:
quote:Originally posted by crmpicco
 what are caveats?
Warnings.



--

Joe (Microsoft MVP - XML)
 
Old February 25th, 2005, 10:58 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

One problem i am having is that sometimes there are more than one 'out' radio button and this knocks it out. how do i get around this problem?

www.crmpicco.co.uk
 
Old February 25th, 2005, 10:59 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

it works fine when there is only one radio button but more than one just leaves them ALL disabled, even after the page has fully loaded.....

www.crmpicco.co.uk
 
Old February 25th, 2005, 11:00 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

theres a
rs.movenext
wend situation

www.crmpicco.co.uk
 
Old February 25th, 2005, 11:16 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

Something like this:

function init()
{
    for (i = 0; i < document.forms[i].elements["out"].length; i++)
    {
        document.forms[i].elements["out"].disabled = false;
    }
}

any ideas guys???

www.crmpicco.co.uk





Similar Threads
Thread Thread Starter Forum Replies Last Post
Radio button gaurisharya C# 2005 2 March 16th, 2008 06:43 AM
radio button anwarraja Javascript 3 September 18th, 2007 08:18 PM
Radio Button hoailing22 ASP.NET 1.0 and 1.1 Basics 1 June 2nd, 2005 12:08 AM
Button acts depending on radio button values janise Access 4 March 10th, 2004 12:53 AM
radio button damnnono_86 Access 5 October 28th, 2003 02:17 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.