#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    2
    Rep Power
    0

    Talking Use JavaScript to get flash cfform object and name


    Hello and thanks in advance

    I have a flash cfform and on this form I have a cfinput button with an onclick event that calls some JavaScript. This JavaScript attempts to run the onclick event of another cfinput button on another flash cfform.

    The problem I''m having is that when I attempt to reference the forms nothing happens.

    If I run:

    var FrmOne = document.forms[ 0 ];
    alert(FrmOne);

    I get an alert that says only "[OBJECT]"


    If I run:

    var FrmOne = document.forms[ 0 ];
    alert(FrmOne.name);

    I get an alert with an empty string. (Btw the form has both a NAME and an ID)


    It's as if JavaScript cannot find the forms, but if I run a JavaScript count of the form elements on the page it comes back with 2, which is what I would expect.

    I've successfully fired the onclick event of a cfinput on a cfform format=flash before and I've been scouring every forum I can find, but no one seems to have covered this particular problem, unless of course I've just been searching it all wrong.

    Any help is very appreciated!!
    Last edited by Atheos; November 14th, 2013 at 07:09 PM. Reason: Title and body text were confusing
  2. #2
  3. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,263
    Rep Power
    968
    A Flash form isn't an HTML form. It's an embedded Flash swf. So very little that you can do with an HTML form is available with Flash forms.

    Basically, Flash forms in CF was a colossal mistake, which is why virtually no one uses them. My advice would be to convert the form to a standard HTML form, which will allow full DOM manipulation and JS form events.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    2
    Rep Power
    0
    If it were practical for me to change it now, I would not use the CF flash form at all and just build this in flex, however, I am inexorably left with the task of modifying the existing version of a set of very large cf flash forms that have a ton of code already existing behind them.

    It seems like I should be able to use an ExternalInterface call in actionscript to the JS from the flash form with a callback as I already do in pop up cfmls with embedded SWFs.

    Anyone have any ideas? Also, if externalinterface callback handler won't work, is there any way I can programmatically expose the cfform's object/name to the external code?
    Last edited by Atheos; November 14th, 2013 at 09:45 PM. Reason: Erroneous text
  6. #4
  7. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,263
    Rep Power
    968
    I don't envy you then. I also did a lot of Flex and AS3 work back in the day. I definitely remember using ExternalInterface to call JS and respond to JS calls. But it's probably been 3 or 4 years, so the details are long gone from memory heh.

    So all I can tell you is that I'm fairly sure what you're talking about CAN be done through ExternalInterface, at least in Flex. But not sure how feasible it is to do this in the constrained environment of Flash Forms.

IMN logo majestic logo threadwatch logo seochat tools logo