New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get struct/arrays from cfml in cfscript javascript #23

Open
matthewroach opened this Issue Nov 27, 2015 · 2 comments

Comments

Projects
None yet
2 participants
@matthewroach
Member

matthewroach commented Nov 27, 2015

When using $cf.get() to get a CFML variable within cfscript javascript it does not translate. See below example, setting and dumping the same struct in cfscript and cfscript javascript are the same output, but if I wanted to get access to the cfscript variable in cfscirpt javascript it does not translate it.

Am I getting the variable correctly?

<cfscript>

    testCFML = {
        items: [
            { name: 'Matthew' },
            { name: 'Alice' }
        ]
    };

    writeDump(testCFML);

</cfscript>

<p>cfscript javascript</p>

<cfscript language="javascript">

    var test = {
        items: [
            { name: 'Matthew' },
            { name: 'Alice' }
        ]
    };

    $cf.writeDump(test);

    print('<hr />');

    var testFromCFML = $cf.get('testCFML')
    $cf.writeDump(testFromCFML);

</cfscript>

screenshot from 2015-11-27 08 59 56

@MFernstrom

This comment has been minimized.

Show comment
Hide comment
@MFernstrom

MFernstrom May 9, 2018

Member

It looks like the data is indeed there, but when you send it back for use with the writedump, it ends up dumping the metadata about the js java object instead of the data you pass.

I created a dump() method for use within cfscript javascript to achieve the data dump.

Member

MFernstrom commented May 9, 2018

It looks like the data is indeed there, but when you send it back for use with the writedump, it ends up dumping the metadata about the js java object instead of the data you pass.

I created a dump() method for use within cfscript javascript to achieve the data dump.

@MFernstrom

This comment has been minimized.

Show comment
Hide comment
@MFernstrom

MFernstrom Jul 19, 2018

Member

I think this can be closed, unless anyone objects?

Member

MFernstrom commented Jul 19, 2018

I think this can be closed, unless anyone objects?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment