Cursor in Form

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • socialism001@yahoo.com

    Cursor in Form

    How would I get the focus command to work using the code below. I'm
    trying to place the cursor in the stnum field when the user opens the
    form. Thanks Chris

    print $query->start_form;

    print $query->textfield(
    -name=>'-stnum',
    -default=>'',
    -size=>14);

    print $query->textfield(
    -name=>'~stnm',
    -default=>'',
    -size=>40);

  • Grant Wagner

    #2
    Re: Cursor in Form

    <socialism001@y ahoo.com> wrote in message
    news:1105550178 .671557.120490@ f14g2000cwb.goo glegroups.com.. .[color=blue]
    > How would I get the focus command to work using the code below. I'm
    > trying to place the cursor in the stnum field when the user opens the
    > form. Thanks Chris
    >
    > print $query->start_form;
    >
    > print $query->textfield(
    > -name=>'-stnum',
    > -default=>'',
    > -size=>14);
    >
    > print $query->textfield(
    > -name=>'~stnm',
    > -default=>'',
    > -size=>40);[/color]

    Setting the focus to an input isn't a property of the input, it's a
    method called (usually when the page loads):

    <body onload="documen t.forms['yourForm'].elements['stnum'].focus();">

    or

    <head>
    <script type="text/javascript">
    window.onload = function()
    {
    document.forms['yourForm'].elements['stnum'].focus();
    }
    </script>
    </head>

    or endless variations of the two mechanisms above.

    --
    Grant Wagner <gwagner@agrico reunited.com>
    comp.lang.javas cript FAQ - http://jibbering.com/faq


    Comment

    • socialism001@yahoo.com

      #3
      Re: Cursor in Form

      Thanks that did exactly what I needed.

      Chris

      Comment

      Working...