-----end find_res.cfm-------------- yourPage.cfm ----------------------------------------- ... Basically yourPage.cfm calls the find_res page if the needed form field is not available. find_res.cfm uses JS to populate 2 hidden form fields and submits it back to yourPage.cfm to use. It can be a little slow and may confuse users if they see the screen load(s), but it is a solution. CR [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => CRidgway [ip] => webforumsuser@m [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 2 [islastshown] => 1 [isfirstshown] => [attachments] => [allattachments] => ) --> pass javascript variable to cold fusion - Macromedia ColdFusion

pass javascript variable to cold fusion - Macromedia ColdFusion

anyone know if there's a way to pass a Javascript variable to Cold fusion? Or a good article that shows how to do this?...

Sponsored Links
  1. #1

    Default pass javascript variable to cold fusion

    anyone know if there's a way to pass a Javascript variable to Cold fusion? Or a good article that shows how to do this?

    Sponsored Links
    timrande Guest

  2. #2

    Default Re: pass javascript variable to cold fusion

    I found this somewhere a while back and use it at times...

    find_res.cfm
    --------------------------------------------------
    <CFIF IsDefined("URL.ReturnTo")>
    <CFSET session.FormAction=URL.ReturnTo & ".cfm">
    <CFELSE>
    <CFSET session.FormAction="index.cfm">
    </CFIF>
    <html>
    <head>
    <title>Processing request</title>

    <!--- This function grabs the screen resolution and assigns the height and
    width
    values to hidden form variables.
    --->
    <SCRIPT LANGUAGE="JavaScript">

    function getscreen() {
    var screenW = 640, screenH = 480;
    if (pInt(navigator.appVersion)>3) {
    screenW = screen.width;
    screenH = screen.height;
    }
    else if (navigator.appName == "Netscape" && pInt(navigator.appVersion)==3
    && navigator.javaEnabled()) {
    var jToolkit = java.awt.Toolkit.getDefaultToolkit();
    var jScreenSize = jToolkit.getScreenSize();
    var url1;
    screenW = jScreenSize.width;
    screenH = jScreenSize.height;
    }

    <!--- Assign JavaScript Variables to Hidden Form Fields --->
    doent.f1.sw.value = screenW;
    doent.f1.sh.value = screenH;
    doent.f1.submit();
    }

    </SCRIPT>
    </head>

    <!---
    This code forces the form to run the getscreen function
    as soon as the page loads. Since the getscreen function has a
    submit function in it this page is never seen and the form fields are
    passed on to whatever page is set for the Form Action attribute.
    --->
    <body background="images/bground.jpg" onload="getscreen()">
    <CFOUTPUT>
    <form name="f1" action="#session.FormAction#" method="post">
    <input type="Hidden" name="sw">
    <input type="Hidden" name="sh">
    </form>
    </CFOUTPUT>
    </body>
    </html>

    -----end find_res.cfm--------------

    yourPage.cfm
    -----------------------------------------
    <CFIF Not IsDefined("session.screen_w")>
    <CFIF IsDefined("form.sw")>
    <CFSET session.screen_w=(form.sw * 0.9)><!--- same as 90% --->
    <CFELSE>
    <CFLOCATION addToken="no" URL="find_res.cfm?ReturnTo=index">
    </CFIF>
    </CFIF>
    ...

    Basically yourPage.cfm calls the find_res page if the needed form field is not
    available. find_res.cfm uses JS to populate 2 hidden form fields and submits
    it back to yourPage.cfm to use. It can be a little slow and may confuse users
    if they see the screen load(s), but it is a solution.

    CR

    CRidgway Guest

Similar Threads

  1. Discussion assign javascript variable into cold fusion
    By dev29 in forum ColdFusion
    Replies: 0
    Last Post: June 13th, 03:40 PM
  2. Migrating from Cold fusion 5 to Cold fusion 7
    By Ashish Khanna in forum Coldfusion Server Administration
    Replies: 1
    Last Post: October 6th, 12:37 PM
  3. pass a variable from javascript to actionscript2.0 inopera9 browser
    By kingdom_of_revenge in forum Macromedia Flash Data Integration
    Replies: 0
    Last Post: February 1st, 08:14 AM
  4. Accessing Cold Fusion application variable usingJavascript
    By mdemahy in forum Coldfusion - Advanced Techniques
    Replies: 2
    Last Post: May 6th, 03:35 PM
  5. Javascript variables to cold fusion
    By hivaluescomputing in forum Coldfusion - Advanced Techniques
    Replies: 1
    Last Post: February 25th, 03:52 AM

Bookmarks

Posting Permissions

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