Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default setting focus

    K I got a huge form with multiple postbacks done in javascript, I hope im just
    doing something stupid, or overlooking a simple CF trick. I need to set the
    focus after the postback, only my function doesn't keep control after the
    postback. here is my code example function postback1(){ if
    (isblank(form1.actnum.value)){ alert('Must select a
    account first!'); form1.actnum.focus();
    return false; } else{ document.form1.action =
    'orderformh4.cfm'; document.form1.submit(); document.form1.promo.focus;
    } } and here is the page my code is on, don't be to brutal im
    just now debugging it ;-)
    [url]http://www.tirecenters.com/T3/form/orderformh4.cfm[/url] The end result of the input
    is a print quality PDF for dealers to create there own coupons to be sent to
    the newspapers. BTW suggestions would be nice

    StokeyTCI Guest

  2. Similar Questions and Discussions

    1. Setting Focus in UserControl
      I have an editable datagrid as part of a usercontrol. When I click the Edit button, I wish for focus to be set on the first control, a...
    2. setting focus from one textInput to another
      Hello Everyone I am using flash mx 2004 professional. What I am trying to do is give focus to a text box based on some criteria of another text...
    3. setting and changing focus
      I am having a brain dead day and can not remmember how to do the following: I have a Flash Form and I want to change and set the focus for fields...
    4. Setting focus..?
      Hi all, I have a Webform with some textboxes on. How can I set the focus so that a user can start the input directly in the first textbox in...
    5. setting focus to textbox
      Hello, Can someone tell me if/how I can set the focus to a textbox so when the page loads the cursor is placed in the textbox and the user can...
  3. #2

    Default Re: setting focus

    O yeah postback1 fires after selecting an account I want focus to go the the promotion select
    StokeyTCI Guest

  4. #3

    Default Re: setting focus

    Guess ill just wrap the body tag in cf if's and have focus set based on what fields are/are not defined, was hoping there was some cf way to do it


    Cheers



    Chris
    StokeyTCI Guest

  5. #4

    Default Re: setting focus

    Well that didn't work says element postcount isn't defined in form but I don't
    understand since it is wrapped in an isdefined

    <body
    <cfif isdefined(#form.postcount#)>
    <cfif #form.postcount# is 0>
    onLoad="document.form1.acolor.focus();"
    </cfif>
    </cfif>
    >
    any ideas?

    StokeyTCI Guest

  6. #5

    Default Re: setting focus

    im assuming its beause im imbedding CF inside Javascript right?
    so does that mean if I do the if in javascript instead of cf it should work?

    guess Ill try that
    StokeyTCI Guest

  7. #6

    Default Re: setting focus

    K so much for that, still won't allow me to assign focus,

    function wfocus() {
    alert("function called");
    form1.acctnum.focus();
    }

    <body onLoad="wfocus();">

    I get the alert, clear the alert and then I get a java error, I'm at my wits
    end.

    Any ideas ?

    Anyone?

    ECHO
    ECHO


    Cheers

    Chris


    StokeyTCI Guest

  8. #7

    Default Re: setting focus

    the isDefined call doesn't work because you're supposed to pass it a string
    representation of your variable, not the variable in pounds.

    You put:
    isDefined(#form.postcount#)

    it should be:
    isDefined('form.postcount')

    Kronin555 Guest

  9. #8

    Default Re: setting focus

    OMG I can't believe I spent a day and a half, because of a typo

    Thanks Bra


    Chris
    StokeyTCI Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139