creating javascript layer help

Ask a Question related to Coldfusion - Getting Started, Design and Development.

  1. #1

    Default creating javascript layer help

    I have created a javascript function within a cfm page that will allow me to
    show a previously created layer, depending on what is selected from the select
    menu. That code is attached. However, because the page creates the layer when
    it loads, and thus creates the javascript calendar inside the page when it
    loads, the date fields in the calendar are filled into the form on the page,
    and then inserted into the database when the user submits the page.

    What I would like to do, is either somehow disable the calendar inside the
    layer until it is displayed, or perhaps create everything; the layer and the
    calendar inside, when the user clicks in the menu.

    Can someone help with this? I'm familiar with Coldfusion 6, but we recently
    bought version 7, so it might have something I can use instead of javascript.
    Please help. Thanks.


    function go(divname)
    {
    box = document.forms[0].followup_how;
    if (box.options[box.selectedIndex].value=='respond'){
    document.getElementById(divname).style.display='bl ock';}
    else {document.getElementById(divname).style.display='n one';}
    }

    <td><select name="followup_how"
    onChange="makeLayer('LYR1',200,10,100,100,'red',1, 1)">
    <option value="fyi">FYI</option>
    <option value="respond">Respond By Date:</option>
    <option value="urgent">Urgent Followup</option>
    </select></td>

    <div id="responddate" class="verdana" style="position:absolute; left:320px;
    top:<cfoutput>#height+705#</cfoutput>px; z-index:9; border: 1px none #000000;
    display:none">
    <script type="text/javascript">DateInput("respond", "False")</script></div>

    pelican Guest

  2. Similar Questions and Discussions

    1. Creating a yes/no messagebox in Javascript
      Hi all, Is it possible to create a Javascript messagebox that shows the buttons Yes and No instead of normal confirm? Regards John.
    2. Creating PDF from a set of TIFFs with OCR text layer
      We will be scanning in massive amounts of documents and need to create or find a solution for converting the resulting TIF images to PDF. We also...
    3. PS CS - Javascript Error on Scripts > Layer Comps to PDF?
      Joe, Did you ever get a fix for this? I have just hit the same problem, when I try to run Dr Browns Image processor script...'javascript plug-in...
    4. Javascript > resize layer to fit content
      Does anyone have a javascript which can, after clicking some button, rezise a layer to the content which is in it. Thank you, Robert Jansen
  3. #2

    Default Re: creating javascript layer help

    I'm presuming that your JavaScript function DateInput() outputs the calendar
    object, with various form fields in it. And if I understand correctly, these
    form fields are being passed through even if the calendar has not been selected
    for viewing.

    If this is the case, what you might want to do is set the DateInput() function
    to output the form fields with the "disabled" attribute, then modify your
    go(divname) function so that when it sets the display value to "block" it also
    sets the disabled flag to false for each one of these fields, and (obviously)
    when it's setting the display back to "none" it sets the disabled flag back to
    true.

    Fychan66 Guest

  4. #3

    Default Re: creating javascript layer help

    The Dateinput function is contained on a separate js file. I access the
    function by including this in the header: <script type="text/javascript"
    src="calendarDateInput.js"></script>, and then I place this line where I want
    the calendar to appear: <script type="text/javascript">DateInput("respond",
    "False")</script>. Respond is the name id, and false means it is not required.
    I don't think I can mark such a menu calendar as disabled, at least I don't
    know how. Any ideas? Thanks.

    pelican Guest

  5. #4

    Default Re: creating javascript layer help

    Marking a field as disabled is fairly easy...

    <form name="myform" method="post" action="submit.cfm">
    <input type="text" name="disabledfield" value="disabled" disabled>
    </form>

    will do it (certainly in HTml 4.0 browsers).

    Then if you want to re-enable it you can use the style sheet DTD to do it
    (in IE like this:)
    <script language="JavaScript" type="text/javascript" defer>
    // re-enable a field
    document.myform.disabledfield.disabled = false;
    // disable a field
    document.myform.disabledfield.disabled = true;
    </script>
    I think you need to change the reference for Mozilla / Netscape etc browsers,
    but there should be enough tutorials in Google to let you work out the
    differences.

    Caveat: Code above is from memory, should work, or at least not be too far off
    ;)

    Phil

    Fychan66 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