Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getting the proper form element problem.

Status
Not open for further replies.

Glowworm27

Programmer
Joined
May 30, 2003
Messages
587
Location
US
I have some Javascript, on an ASP.Net page and I cannot get this script to work.

Code:
function ShowCalAll(e, sControlName)
{
    if (!e)
        e = window.event;
    if (!popup)
        popup = new RadCalendar.Popup();
    //if (!calendarContainer
        calendarContainer = document.getElementById("calCheckIn1");
    var inputBox = document.getElementByID(sControlName.ClientID +'_textbox');
    var x = PositionX(inputBox);
    var y = PositionY(inputBox) + inputBox.offsetHeight;
    popup.Show(x, y, calendarContainer);
    if (e)
    {
        e.cancelBubble = true;
        if (e.preventDefault) e.preventDefault();
    }
}

I am calling it on the html page using this code
Code:
<div onclick="ShowCalAll(event, RadDateInput1)">
                                    <radi:RadDateInput id="RadDateInput1" Runat="server" DateFormat="d" Skin="Default" RadCalendarId="calendarCheckIn" RadControlsDir="RadControls/" Width="119px" MinDate="1800-01-01"></radi:RadDateInput>
                                </div>

basically what I want is to pass the control to the javascript function get the control name (clientid) then display a calender underneath the control on the form.

The error is that RadDateInput1 is Undefined. I cannot understand why the control id is not being passed to the javascript.

I hope you can help
Thanks In Advance.

[cannon]

George Oakes
Check out this awsome .Net Resource!
 
Maybe change the javascript to be:
Code:
<div onclick="ShowCalAll(event, [COLOR=red]'[/color]RadDateInput1[COLOR=red]'[/color])">

If that doesn't work, view the source of the page using the browser... then post that part of the html that is wrapped in the div.

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
there are other things wrong as well..

[tt]getElementByI[red]d[/red][/tt] is case-sensitive.

like Jeff said, we'll need to see the HTML generated and read by the browser.



*cLFlaVA
----------------------------
[tt]( <P> <B>)13 * (<P> <.</B>)[/tt]

[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top