Problems mixing Flash & non-Flash form elements...

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

  1. #1

    Default Problems mixing Flash & non-Flash form elements...

    I have a flash cfgrid wrapped inside a non-flash cfform tag along with other
    non-flash form elements. When the user selects a grid row, the flash cfgrid
    onchange calls an actionscript, the actionscript calls a javascript function
    passing the selecteditem grid row values which are used to populate the other
    form elements via javascript & DOM.

    I started off cautiously with explicit numerical & string values - not a
    problem. But when I tried to pass values dynamically, only the variables
    containing numerical values were recognized by the javascript. Below is the
    test I ran... here are the results:

    Initial Grid Row Values:

    someNumber = 578;
    someString = "myString";

    TEST 1: myVar = someGrid.selecteditem.someNumber;
    >> actionscript alert outputs: "578number".
    >> javascript alert outputs : "578number".

    TEST 2: myVar = someGrid.selecteditem.someString;
    >> actionscript alert outputs: "myStringstring".
    >> javascript alert fails.

    TEST 3: myVar = "578";
    >> actionscript alert outputs: "578string".
    >> javascript alert outputs : "578number".

    TEST 4: myVar = "578";

    **changed actionscript getURL() to pass asType instead of myVar...
    >> actionscript alert outputs: "578string".
    >> javascript alert fails.

    I'm viewing in IE, but to check the JS I switched to Firefox & the following
    message showed up in the JavaScript Console when it failed on TEST 2:

    Error: myString is not defined
    Source File: javascript: passStr(myString)

    Does anyone know if there is any way to pass dynamically created string
    variables to javascript via the getURL() actionscript function?



    <script language="javascript">

    function passStr(msg)
    {
    var jsType = typeof(msg);

    alert(msg + jsType);
    }

    </script>


    <cfsaveContent variable="onClick">

    var myVar = some-grid-row-value;

    var asType = typeof(myVar);

    alert(myVar + asType);

    getURL("javascript:passStr(" + myVar + ")");

    </cfsavecontent>


    <cfform name="someForm">

    <cfgrid name="someGrid" query="someList" onChange="#onClick#"
    rowheaders="false" format="flash" >

    <cfgridcolumn name="someNumber" header="Job">
    <cfgridcolumn name="someString" header="Data?">

    </cfgrid>

    </cfform>

    rmarmer Guest

  2. Similar Questions and Discussions

    1. Mixing Flash and Flex
      i have a basic question that's probably been answered before. can you mix Flash applications and Flex applications together? for example, i want...
    2. Problems with flash form cfselect
      i have problems with this code, how can i load a data in a cfselect I'm using this code and nothings happend please help me <CFQUERY...
    3. Flash form load problems
      Hi, We have been banging our heads against the wall for some time with flash forms, but now this is a real puzzeler. We have just upgraded one...
    4. Flash sound mixing
      Hi all, I'm facing some problem with the flash cast member and background sound. when i puppet a background sound, the flash member won't play the...
    5. Problems mixing regular form fields with file uploads
      I'm trying to build a form that includes both regular form fields, such as text inputs and checkboxes, along with file uploading. It seems, though,...
  3. #2

    Default Re: Problems mixing Flash & non-Flash form elements...

    I am having a similar error. I have a flash cfgrid within an HTML form. The
    grid is not passing or populating the needed arrays of values to the action
    page. I have a case logged with MM support. I will get back to this forum when
    I know more.

    Thanks!

    CF_DAWG Guest

  4. #3

    Default Re: Problems mixing Flash & non-Flash form elements...

    Hey,

    I finally got the following to work... note: the single quotes (it's hard to
    see with the font used in this forum)
    around " + myVar + " but within the paren in 2 & 3 !

    See if this does it for you...


    javascript: alert(msg + '/' + typeof(msg));

    1) myVar = 999;
    getURL("javascript:callJS(" + myVar + ")");

    js output: 999/number

    2) myVar = "myString";
    getURL("javascript:callJS('" + myVar + "')");

    js output: myString/string

    3) myVar = 999;
    getURL("javascript:callJS('" + myVar + "')");

    js output: 999/string


    Just out of curiosity...

    The two main reasons that I am not enclosing everything in format=flash
    context are:
    1) Flexibility!

    2) The relative cost in user perception caused by flash forms having to
    re-initialize every time the user switches back & forth btw pages...

    Howvever, at the same time, & from a "lazy developer" perspective, I'd still
    like to use flash form elements if I can arrive at what feels like a reasonable
    compromise.

    In this case, the compromise is using only the grid in flash format. This buys
    me;

    1) The benefits of cfgrid in flash format

    2) The flexibility to still use html form elements such a s fieldset...

    2) The non-flash form elements load immediately, drawing the users attention
    to those elements & making the initialization of the flash grid seem to take
    less time - or so the logic goes...

    What is your rationale around mixing & matching?

    Thanks!



    rmarmer Guest

  5. #4

    Default Re: Problems mixing Flash & non-Flash form elements...

    My rationale is very much the same as your's for using the flash version of
    cfgrid.

    1. I don't want users to have to download or use the JVM from Sun or Microsoft
    in order to use my application.
    2. I am not a fan of applets and flash is more light weight.
    3. Within my company, we have flash as a standard install on all machines, so
    I know it will work on any machine. The applets are hit and miss.
    4. I also like the look and feel presented by the flash cfgrid. It provides a
    better display of the data and not so much scrolling is need to view it.

    Thanks for the info! I will try what you provided. I have not heard anything
    back on my case from Macromedia. When I do I will post it.

    CF_DAWG 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