cfset FORM.UnitsProd = FORM.EndUnits - (FORM.StartUnits) + 1

Good morning all,
I am having a problem with this formula. <cfset FORM.UnitsProd = FORM.EndUnits - (FORM.StartUnits) + 1 >
When FORM.StartUnits = 1 then, my calculations are wrong. For instance, EndUnits and StartUnits represent serial numbers, which I can then, total as UnitsProd. If EndUnits = 3 and StartUnits = 1; I get 3 = 3-1+1. But, 15 = 60 - 46 +1. Would a cfif statement resolve this?
<cfset FORM.UnitsProd = FORM.EndUnits - (FORM.StartUnits) + 1 >
<cfif>
#FORM.StartUnits# = 1
<cfelse>
<cfset FORM.UnitsProd = FORM.EndUnits + FORM.StartUnits >
</cfif>
Does this make sense?
Thanks in advance,
DJ Khalif

"UnitsProd = EndUnits - StartUnits + 1, (3 = 3 - 1 + 1). This should be 4"
I think you need to take your calculator back to the store - that's correct, it should be (and is) 3.
3 - 1 = 2
2 + 1 = 3
Or, to make it simpler, the "- 1" and "+ 1" cancel each other out, so it becomes:
3 = 3
Your app is running correctly, it's your verification calculations which are wrong.

Similar Messages

  • Change hidden form field value

    hi everyone...i'm hoping someone can help me figure out how
    to change the value of a hidden field in a form. i have a page
    setup where users pay a website fee. since the fee is always the
    same, i have the amount setup in a hidden field in my form. my
    question is, i'd like to use promo codes. so i'll add a box in my
    form that says "enter promo code." then there's a link in the form
    that says "apply promo code." i'm thinking that link needs to
    refresh my page and take the value entered by the user in the promo
    code form field and place it in the url. that way i can write a
    cfif statement to change the value of the hidden field. the problem
    is, i can't figure out how to "refresh" the page and take the value
    out of the form field and place it in the url. hope this makes
    sense. maybe someone can offer a better way to do this? i'd truly
    appreciate any help anyone can offer. thanks!

    You would change the amount on the processing page with
    ColdFusion (after the form is submitted), but prior to the CFHTTP
    call. You really should familiarize yourself with CFHTTP (check
    online documentation). It sounds like it is exactly what you need.
    The format of your application would be something like:
    promocode.cfm:
    ====================
    <form name="someform" method="post"
    action="process.cfm">
    <input type="text" name="name">
    <input type="text" name="address">
    <input type="text" name="promocode">
    <input type="hidden" name="order_price"
    value="#OrderValue#>
    </form>
    process.cfm
    ======================
    <!--- Apply promo code --->
    <cfif form.promocode eq "Promo1">
    <cfset form.order_price = .75 * form.order_price>
    </cfif>
    <cfset sales_tax = .1 * form.order_price>
    <!--- Send data to processor gateway --->
    <cfhttp url="https://www.myProcessor.com/gateway/"
    method="POST">
    <cfhttpparam type="FORMFIELD" name="price"
    value="#form.order_price#">
    <cfhttpparam type="FORMFIELD" name="tax"
    value="#sales_tax #">
    <cfhttpparam type="FORMFIELD" name="cc_number"
    value="#cc_num #">
    </cfhttp>
    <!--- Check response --->
    <cfif FindNoCase("Success Text", CFHTTP.fileContent)>
    Good Response
    <cfelse>
    Bad Response
    </cfif>

  • Set form value from MyQuery

    <cfif structKeyExists(MyQuery, "MyID")>
    <CFSET form.MyID= MyQuery.MyID>
    </cfif>
    <cfif structKeyExists(url, "MyID")>
    <CFSET form.MyID= url.MyID>
    </cfif>
    I use above code to check if query ID exists then assign value to my form variable.
    It seems that it does not work, but it works for url.
    Can you please help and advise are there any way to check value in query and assign to the form if it is defined?
    Your help and information is great appreciated,
    Regards,
    Iccsi,

    For assigning the value to form field you can directly use value="#MyQuery.MyID#"
    For eg:<cfform><cfif structKeyExists(MyQuery, "MyID")> <cfinput type="text" Name="MyID" value="#MyQuery.MyID#"></cfif></cfform>
    So the input text will be visible if value in query is defined else the correct data will be populated to form field MyID

  • Convert dynamic form to dynamic input form

    Hi All,
    I am using Jdeveloper 11.1.2.4.
    As a part of a requirement, I have created a dynamic form built out of a read only view object.
    On a user event (button press), I want to convert the form into an input form to allow the user to make suitable change to data and save to the database.
    At this stage I have programmatic access to the table name which is being used to create the dynamic form.
    Please suggest on how to convert the dynamic form into input form.
    Best Regards,
    Ankit Gupta

    <cfupdate> process data from the form scope. You are
    not putting your
    role datum into the form scope. You need to scope the
    variable in your
    cfset(s).
    <cfset form.roleColumn = form.role=>
    But I am not sure this would work well. It is probably better
    if you
    write your own SQL. <cfinsert> and <cfupdate> are
    for very basic
    database operations. Once you start putting other processing
    requirements in, such as this, they quickly become
    inadequate.
    Try replacing your <cfupdate> with a <cfquery>
    tag something like this.
    <cfquery datasource="my_DSN">
    UPDATE my_table
    SET lastName = '#form.lastName#',
    firstName = '#form.firstName#',
    #form.role# = true
    WHERE key = value
    </cfquery>
    I made my best guesses at how this SQL would look based on
    the examples
    you have provided. You'll have to finish it off based on your
    actual
    requirements.
    Mikelaskowski wrote:
    > Thanks,
    > I really like your solution. It definatly sounds a lot
    easier.
    > I am still having a little trouble though. I am probably
    missing something
    > silly (especially in my cfupdate tag) as I am a little
    new at this stil.
    >
    > When I used your code in my action page I get the
    following error:
    > Error Occurred While Processing Request
    > Variable PRESIDENT is undefined. <--when president is
    selected in the role
    > field. It changes nicely when another is selected.
    >
    > Here is my current code on my action page:
    >
    >
    > Thanks Again!!!
    >
    > <CFSET lastFirst = lastName & ", " &
    firstName>
    > <CFSET roleColumn = Evaluate(role)>
    > <cfupdate datasource="my_DSN"
    tablename="my_table">
    > <html>
    > <head>
    > <title>Title</title>
    > </head>
    > <body>
    > <cfoutput>The role is #roleColumn#<br>
    > The value is #lastFirst#</cfoutput>
    > </body>
    > </html>
    >

  • Review my Code

    Good everyone,
    Can someone look at my code to tell me if there is a way make it more compact. I want to stop users from entering the same data over and over.
    <cfif 'FORM.StartUnits' eq 0>
    <cflocation url="../errorPages/startunitsGTendunits.cfm">
    <cfelseif FORM.StartUnits GT FORM.EndUnits>
    <cflocation url="../errorPages/startunitsGTendunits.cfm">
    <cfelseif IsDefined('FORM.Workorder')>
    <cfelse>
    <cflocation url="../Production/workordersearch.cfm">
    </cfif>
    <cfset FORM.DelayTime = (FORM.DelayTimeHours + (FORM.DelayTimeMinutes/60)) >
    <cfset FORM.ProdTime = (FORM.ProTimeHours + (FORM.ProTimeMinutes/60)) >
    <cfset FORM.CoTime = (FORM.CoTimeHours + (FORM.CoTimeMinutes/60)) >
    <cfset FORM.UnitsProd = FORM.EndUnits - (FORM.StartUnits) + 1 >
    <cfparam name="FORM.WorkOrder" default="1">
    <cftransaction>
    <cftry>
    <cfquery name="insertProduction" datasource="#REQUEST.datasource#">
    IF NOT EXISTS
    select WorkOrder, StartUnits
    from tbl_Assembly_Production
    where workorder = '#FORM.Workorder#' and StartUnits = '#FORM.StartUnits#'
    BEGIN
    INSERT INTO tbl_Assembly_Production (dateProd, Shift, Area, Jig, EmpNo, WorkOrder, Item, Model, ProdTime, CoTime, startUnits, endUnits, NpTime, UnitsProd, ProdDelayTime, CoDelayTime, Comment)
    VALUES ('#Trim(FORM.dateProd)#',
            '#Trim(FORM.Shift)#',
            '#Trim(FORM.Area)#',
            '#Trim(FORM.jig)#',
            '#Trim(FORM.EmpNo)#',
            '#Trim(FORM.WorkOrder)#',
            '#Trim(FORM.Item)#',
            '#Trim(FORM.Model)#',
            '#Trim(FORM.ProdTime)#',
            '#Trim(FORM.CoTime)#',
            '#Trim(FORM.startUnits)#',
            '#Trim(FORM.endUnits)#',
            '#Trim(FORM.NpTime)#',
            '#Trim(FORM.UnitsProd)#',
            '#Trim(FORM.ProdDelayTime)#',
            '#Trim(FORM.CoDelayTime)#',
            '#Trim(FORM.Comment)#')
    END       
    </cfquery>
    Thank You. Work Order <cfoutput>#FORM.WORKORDER#</cfoutput> with Starting Unit <cfoutput>#FORM.StartUnits#</cfoutput> has already been entered. You can enter this unit only once!!!.
    <cfcatch type="database">
    Work Order <cfoutput>#FORM.WORKORDER#</cfoutput> with Starting Unit <cfoutput>#FORM.StartUnits#</cfoutput> is already entered.  Record Not Inserted!!!.
    </cfcatch>
    </cftry>
    <cfquery name="insertAssemblyDelay" datasource="#REQUEST.datasource#">
    INSERT INTO tbl_Assembly_Delay(ID, Code, DelayTime)
    SELECT ID , '#Trim(FORM.Code)#', '#Trim(FORM.DelayTime)#'
    FROM tbl_Assembly_Production
    WHERE tbl_Assembly_Production.WorkOrder = '#FORM.WorkOrder#'
    </cfquery>
    <cftry>
    <cfset list1 = #FORM.Unit# >
    <cfset list2 = #FORM.WorkOrder#>
    <cfset list3 = #FORM.YearAssy#>
    <cfloop list="#list1#" index="j">
    <cfloop list="#list2#" index="k">
    <cfloop list="#list3#" index="m">
    <cfquery name="insertunits" datasource="#REQUEST.datasource#">
    IF NOT EXISTS
    select ID, Workorder, Unit
    from tbl_Assembly_Unit
    where Workorder = '#k#' and Unit = '#m#'
    BEGIN
    Insert into tbl_assembly_Unit(ID, YearAssy, WorkOrder, Unit)
    SELECT ID, '#Trim(FORM.YearAssy)#', '#Trim(k)#', '#Trim(j)#'
    FROM tbl_Assembly_Production
    WHERE tbl_Assembly_Production.Workorder = '#FORM.WorkOrder#'
    END
    </cfquery>
    </cfloop>
    </cfloop>
    </cfloop>
    Your Unit(s) have been added.
    <cfcatch type="database">
    The Unit(s) you listed cannot be more than once.
    </cfcatch>
    </cftry>
    </cftransaction>

    It's probably simpler than you think.  For the sake of this demo, I'll assume your 3 lists have the same number of elements.  You can simply do this.
    <cfloop from = "1" to = ListLen(List1), index = "ii">
    insert into your table (field1, field2, field3)
    values
    (ListGetAt(List1, ii)
    , ListGetAt(List1, ii)
    , ListGetAt(List1, ii) )
    closing tags, proper syntax, etc.

  • Help with updating a database while in cfloop

    Greetings. I'm having some difficulties in updating a
    database using cfquery inside of a cfloop.
    Background:
    I've got a text file that I need to interpret, line for line,
    and then update an existing database with information from that
    text file. For example, the text file might say
    jdoe~103 Anywhere St.~East Nowhere~New Jersey~05784~
    asmith~8963 North St.~Crabapple Cove~Maine~01390~
    (etc...you get the idea)
    So, I use a CFFILE to read the file, and then calculate the
    number of lines (records to be updated in the database) using
    listlen / 5 (in this example). From there, I:
    <cfloop index="record" from="1" to "#numberoflines#">
    <cfloop index="field" from="1" to "5">
    <cfset position = ((record - 1) * 5) + field>
    <cfelseif field EQ 1>
    <cfset form.username =
    ListGetAt(newcontents,position,"~")>
    <cfelseif field EQ 2>
    <cfset form.street =
    ListGetAt(newcontents,position,"~")>
    (etc...through EQ 5)
    </cfloop>
    <cfquery name="updatedatabase"
    datasource="clientlist">
    UPDATE clients
    SET
    Street= '#form.street#',
    (etc)
    WHERE email = '#form.username#'
    </cfquery>
    </cfloop>
    The problem I am having is that it updates the very first
    record in the set of records to update, but then it does not update
    any subsequent records.
    Why?
    Sorry if the code is crude. Is there a better way of doing
    this? If so, great detail would be helpful :) Relatively new at
    this.
    -Brian

    quote:
    Originally posted by:
    Dan Bracuk
    Updating a db from a file using cold fusion is generally
    inefficient and should only be used as a last resort. If your db
    has any bulk loading/updating utilities, consider using them. Maybe
    you can use cold fusion to upload the file and ftp it to your db
    server or something like that.
    Better yet, that file has to come from somewhere. Is there a
    way you can update your db instead of generating a file in the
    first place?
    The file starts as an output generated by a web user (an
    administrator on the software) which creates a text file containing
    email addresses, one per line. An external process which I have no
    control over takes that file and generates another file containing
    information about each of those e-mail addresses (last name, first
    name, etc) one per line. I can't change that process. So, I'm left
    with an external text file that I need to parse and then put into
    the database...all through a web interface. The goal here is that
    an administrator of the software, who does not have direct access
    to the database, can (using cold fusion processing) update the
    database with new information on each e-mail address without my
    intervention.
    -Brian

  • Dynamic variable names and invalid_character_err

    I'm neither an expert at structure notation nor dynamic
    variable naming conventions and would appreciate any help with the
    following. Thanks!
    This code works fine.
    <cfset idx="123">
    <cfset form.product[idx]=StructNew()>
    <cfparam name="form.product[idx].product_nm"
    default="Raspberry Jam">
    <cfform name="data_entry" method="post" format="flash"
    height="525" width="675" action="formdump.cfm">
    <cfformgroup type="tabnavigator" height="400"
    width="650">
    <cfformgroup type="page" label="Product #idx#">
    <cfinput name="static_form_name" type="text"
    label="Product" value="#form.product[idx].product_nm#" height="350"
    width="600" readonly="yes">
    </cfformgroup>
    </cfformgroup>
    </cfform>
    The following code results in the following error:
    "ORG.W3C.DOM.DOMEXCEPTION ERROR. Message: INVALID_CHARACTER_ERR: An
    invalid or illegal XML character is specified." The only change is
    in the "name" attribute of the <cfinput> tag:
    <cfset idx="123">
    <cfset form.product[idx]=StructNew()>
    <cfparam name="form.product[idx].product_nm"
    default="Raspberry Jam">
    <cfform name="data_entry" method="post" format="flash"
    height="525" width="675" action="formdump.cfm">
    <cfformgroup type="tabnavigator" height="400"
    width="650">
    <cfformgroup type="page" label="Product #idx#">
    <!--- Change value of name attribute from
    "static_form_name" to "product[idx].product_nm" --->
    <cfinput name="product[idx].product_nm" type="text"
    label="Product" value="#form.product[idx].product_nm#" height="350"
    width="600" readonly="yes">
    </cfformgroup>
    </cfformgroup>
    </cfform>
    Pam Grieger
    [email protected]

    Thanks for the info. Knowing what WON’T work is
    helpful!
    Here’s what I’m trying to do. I’m rewriting
    one of my apps, switching out conventional HTML form controls for
    <cfform> controls in Flash format. Many of the existing forms
    in my app are for updating data contained in a central database.
    When such a form is rendered to the screen, each form control is
    pre-populated with existing data. All form controls are named
    dynamically based upon the unique ID of the record being updated.
    Here’s a streamlined but typical example:
    <!--- User selected projects 14, 15, 16, and 17 for
    update. Get existing project data. --->
    <cfquery name="get_project_detail"
    datasource="#application.DataSource#">
    SELECT project_oid_nbr, project_nm
    FROM project_table
    WHERE project_oid_nbr IN (14,15,16,17)
    ORDER BY project_oid_nbr
    </cfquery>
    <!--- Initialize the project_nm form control. Form names
    are dynamic, based upon get_project_detail.project_oid_nbr. --->
    <cfloop query="get_project_detail">
    <cfparam name="form.project_nm_#project_oid_nbr#"
    default="#get_project_detail.project_nm#">
    </cfloop>
    <!--- Create HTML form control. --->
    <table>
    <cfloop query="get_project_detail">
    <tr>
    <td>
    <cfoutput>
    Project #project_oid_nbr#:
    <input type="text" name="project_nm_#project_oid_nbr#"
    value="#Evaluate("form.project_nm_#project_oid_nbr#")#">
    </cfoutput>
    </td>
    </tr>
    </cfloop>
    </table>
    This has been working just fine. However, I’m wondering
    if using the Evaluate() function is the most efficient way to go.
    Therefore I wanted to use structure notation to avoid the
    Evaluate() function, but as mentioned in my original post, this
    naming convention won’t work with <cfform> tags.
    Any suggestions as to the most efficient way to get the same
    result while still using <cfform> tags? Thanks so much!

  • Trouble passing a varible to INSERT page

    I'm a novice and I'm having trouble passing a varible from
    one page into the database.
    I ultimately want to pass the word "Appliances" into the
    database field name called CATEGORY.
    The user clicks on: www.xyz.com/main.cfm?category=Appliances
    to go to the next page. Then the next page has a <form> in it
    and that same page has <CFSET category=#category#>. But when
    the form posts the info into the database with the <CFINSERT>
    on the next page, CATEGORY is empty.
    I've tried: CFSET form.category=#category#>, CFSET
    form.category="#category#"> and some other things. I've even
    thought of doing this: <FORM
    ACTION="insert.cfm?category=#category#" method="post">, but that
    didn't work either (I thought I was pretty smart when I thought of
    that). :-)
    Now, I have JUST learned that I can use the <INPUT
    TYPE="hidden" NAME="category" VALUE="#category#"> to pass it BUT
    why didnt a simple CFSET statement set the variable and pass it to
    the CFINSERT?
    Thanks in advance!! -Tony

    yes, <cfinsert> tag only inserts FORM values, that is
    values defined in
    the FORM scope variables (form fields, effectively). it will
    not insert
    any values defined in any other scopes.
    a form will POST (submit) only data in its fields. that is
    why the
    variable you set with CFSET is not submitted - it is not a
    form field.
    so in order to use cfinsert you must have all data you want
    to insert
    into db in form fields. as you have found out, you can have
    hidden form
    fields to post/submit data too.
    you could also pass the variable as part of the query string
    of the
    action page: <form
    action="youractionpage.cfm?yourvar=<cfoutput>#yourvar#</cfoutput>"
    method="post">, but that variable will be available on the
    action page
    inside URL scope, not FORM scope. in order for CFINSERT to
    insert that
    variable in this case, just add <cfset form.yourvar =
    url.yourvar>
    BEFORE your CFINSERT tag on your action page.
    et voila - your variable is part of the form scope now and
    gets inserted
    with cfinsert tag.
    hope this helps.
    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com

  • Complex values cannot be converted to ....

    Hi;
    I have an odd problem I can't seem to figure out....I wrote a couple of neat little functions to create boolean selects, populate them with the values from a database and "select" the correct one inthe html form.
    <cffunction name="booleanSelect" access="public" output="yes" returntype="string"
                description="Creates a booleaen select dropdown" >
            <cfargument name="formvar" required="yes" type="string" />
            <cfargument name="ffalse" required="yes" type="string" />
            <cfargument name="ttrue" required="yes" type="string" />
            <cfscript>
                myvar=evaluate("form.#arguments.formvar#");
                if(myvar eq 0){sel = 'selected="selected"';}else{sel = '';}
                writeoutput('<option value="0" '&sel&' >'&arguments.ffalse&'</value>');           
                if(myvar eq 1){sel = 'selected="selected"';}else{sel = '';}
                writeoutput('<option value="1" '&sel&' >'&arguments.ttrue&'</value>');
            </cfscript>
        </cffunction>
    can be called via:
    <select name="status" id="status">
          <cfscript>booleanSelect('status','Disabled','Enabled');</cfscript>
    </select>
    and that all works [that's the fixed version]
    What I don't understand is why this does not work, the following DOES work in an insert form but not an edit form. and in both cases the form field used to populate the formvar argument is populated and has a value...
    <cffunction name="booleanSelect" access="public" output="yes" returntype="string"
                   description="Creates a booleaen select dropdown" >
            <cfargument name="formvar" required="yes" type="string" />
            <cfargument name="ffalse" required="yes" type="string" />
            <cfargument name="ttrue" required="yes" type="string" />
            <cfscript>
                if(form[arguments.formvar] eq 0){sel = 'selected="selected"';}else{sel = '';}
                writeoutput('<option value="0" '&sel&' >'&ffalse&'</value>');
                if(form[arguments.formvar] eq 1){sel = 'selected="selected"';}else{sel = '';}
                writeoutput('<option value="1" '&sel&' >'&ttrue&'</value>');
            </cfscript>
        </cffunction>
    basically, why do I have to evaluate the formvar argument in one case and not in the other? I think I might be missing something important here....
    -sean

    basically I have a table in a database with a bunch of boolean '1','0'columns.
    I have a function that reads the database table and sets form variables based on the database column and it's default value for an insert action...
    for an update action I have another function that reads the tables data and populates the form variables based on the value in the data column
    - works very well, all I have to do is make sure my form fileds are named the same as in the database
    so for the drop down boolean options I created a function to create the dropdown and select wother the default value or the column value baesd on whether it is an insert or update action... so:
    <select name="status" id="status">
           <cfscript>booleanSelect('status','Disabled','Enabled');</cfscript>
    </select>
    where 'status' is the column name AND the form variable 'form.status' , 'Enabled' & 'Disabled' are just the labels to apply to '1' or '0' on output
    at the top of the insert pages I create the default form variables:
        fieldsDefaults('_column_name_','_fields_to_ignore_');
    which calls:
        <cffunction name="fieldsDefaults" access="public" output="yes" returntype="void"
                        description="creates default form fields froma database query" >
            <cfargument name="table" required="yes" type="string" />
            <cfargument name="ignorelist" required="no" type="string" default="" />
            <cfargument name="column" required="no" type="string" default="false" />
            <cfif arguments.column is not "false">
                <cfquery name="showcolumns" datasource="#application.dsn#">
                    select #arguments.column# from #arguments.table#;
                </cfquery>
                <cfloop query="showcolumns">
                    <cfparam name="form.#createVar(evaluate(arguments.column))#" default="" />
                </cfloop>       
            <cfelse>
                <cfquery name="showcolumns" datasource="#application.dsn#">
                    show columns from #arguments.table#;
                </cfquery>
                <cfloop query="showcolumns">
                    <cfif ListFindNoCase(field,ignorelist) eq 0>
                        <cfparam name="form.#field#" default="#default#" />
                    </cfif>
                </cfloop>
            </cfif>
        </cffunction>
    to create the <cfparam> form defaults...
    now on to the edit.... calls this:
        <cffunction name="dataDefaults" access="public" output="yes" returntype="void"
                        description="creates default form fields froma database query" >
            <cfargument name="table" required="yes" type="string" />
            <cfargument name="id" required="yes" type="numeric" />
            <cfargument name="ignorelist" required="no" type="string" default="" />
            <cfargument name="column" required="no" type="string" default="false" />
                <cfquery name="getnames" datasource="#application.dsn#">
                    show columns from #arguments.table#
                </cfquery>
                <cfquery name="getdata" datasource="#application.dsn#">
                    select * from #arguments.table# where id = '#arguments.id#';
                </cfquery>
                <cfloop query="getnames">
                    <cfif ListFindNoCase(field,ignorelist) eq 0>
                        <cfset form[#field#] = "#getdata[getnames.field]#" />
                    </cfif>
                </cfloop>
        </cffunction>
    which does close to the same thing, but instead populates the form variables with actual database data......
    -sean

  • Dynamic to Static URL

    Dynamic to Static URL's
    what is the best program to use to do this? Because I dont'
    want to make hundreds of static pages, is there a easy way to show
    this properly and get better indexing at the same time. I have
    heard of wordpress, but don't know if it is automated and I think I
    need htaccess file.
    ie:
    FROM:
    www.mysite.com/products.php?store=27
    TO:
    www.mysite.com/products/nike.htm
    thanks

    I did this for a client by simply modifying the 404 error
    page. You do not have to install any special renaming software onto
    your server whatsoever.
    First create a custom 404 error page outputting the
    cgi.query_string of the error page. In that you will see the
    incorrectly called url, which in your case will include the unique
    username.
    Ex:
    404;https://www.yourdomain.com:443/username/
    Extract the username using a combination of your list
    functions...
    Ex:
    <cfset username = listdeleteat(listgetat(CGI.QUERY_STRING,
    3, ":"), 1, "/") />
    Remove the trailing slash if needed...
    Ex:
    <cfset username = listgetat(username, 1, "/") />
    Then cfquery the username. If found, cfinclude the relevant
    index page (if you want the url to stay the same), or cflocation to
    the actually page assigning the username as a url variable. If the
    username is not found, just goto home page.
    Remember to disallow any special characters or top level
    directory names in your usernames.
    <cfloop condition='findoneof("\/:*?""<>|",
    form.urlname)'>
    <cfset form.urlname = removechars(form.urlname,
    findoneof("\/:*?""<>|", form.urlname), 1) />
    </cfloop>
    <cfdirectory action="list" name="alldirs"
    directory="#expandpath('/')#" />
    <cfquery dbtype="query" name="dirs">
    SELECT name
    FROM alldirs
    WHERE type = "Dir"
    AND name = #lcase(form.urlname)#
    </cfquery>

  • Error:widget: CFGRID: Response is empty

    I've an error on the Coldfusion Ajax logger : "error:widget:
    CFGRID: Response is empty". The headings of the cfgrid appear but
    the contents not.
    Here the Coldfusion Ajax logger answer :
    - info:widget: Data loaded for grid, id: refTableau
    - error:widget: CFGRID: Response is empty
    - info:http: CFC invocation response:
    - info:widget: Creating window: cf_window1191833821003
    - info:widget: Created grid, id: refTableau
    - info:http: HTTP GET
    /bulte/admin/produits/gridDataManager.cfc?method=getData&returnFormat=json&argumentCollec tion=%7B%22page%22%3A1%2C%22pageSize%22%3A5%2C%22gridsortcolumn%22%3A%22%22%2C%22gridsortd irection%22%3A%22%22%2C%22idTableau%22%3A%22772%22%7D&_cf_nodebug=true&_cf_nocache=true&_c f_clientid=59BF758DB52E56355D649B34E232903B&_cf_rc=0
    - info:http: Invoking CFC:
    /bulte/admin/produits/gridDataManager.cfc , function: getData ,
    arguments:
    {"page":1,"pageSize":5,"gridsortcolumn":"","gridsortdirection":"","idTableau":"772"}
    - info:LogReader: LogReader initialized
    - info:global: Logger initialized
    Here my cfm page code:
    <cfparam name="URL.id" default="">
    <cfquery name="qRec" datasource="#APPLICATION.db#">
    SELECT *
    FROM Produits
    WHERE id=<cfqueryparam cfsqltype="cf_sql_integer"
    value="#URL.id#">
    </cfquery>
    <cfset FORM.refTableau=qRec.refTableau>
    <cfset MyXmlCode=FORM.refTableau>
    <cfset mydoc = XmlParse(MyXmlCode)>
    <cfset nbcolumns =
    ArrayLen(mydoc.table.tr.XmlChildren)>
    <cfset numLines = ArrayLen(mydoc.table.XmlChildren)>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN" "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml">
    <head>
    <title>fdgdfgdfgdfg</title>
    <link rel="stylesheet" href="../admin.css" />
    <meta http-equiv="Content-Type" content="text/html;
    charset=utf-8" />
    </head>
    <cfwindow width="900" height="600" center="true"
    resizable="false" draggable="true" initshow="true"
    closable="false">
    <cfform name="editForm" action="ifr_refTableau.cfm"
    method="post" format="html">
    <cfgrid format="html"
    name="refTableau"
    pagesize="5"
    sort="yes"
    selectmode="edit"
    delete="yes"
    bind="cfc:gridDataManager.getData({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgri dsortdirection},'#URL.id#')"
    onchange="cfc:gridDataManager.editData({cfgridaction},
    {cfgridrow}, {cfgridchanged})">
    <cfloop from="1" to="#nbcolumns#" index="k">
    <cfgridcolumn name="Col_#k#" header="#k#" display="yes"
    />
    </cfloop>
    </cfgrid>
    </cfform>
    </cfwindow>
    </body>
    </html>
    My cfc code :
    <cfcomponent>
    <cfset THIS.dsn="clients">
    <cffunction name="getData" access="remote"
    output="false">
    <cfargument name="page" required="yes">
    <cfargument name="pageSize" required="yes">
    <cfargument name="gridsortcolumn" required="no">
    <cfargument name="gridsortdirection" required="no">
    <cfargument name="idTableau" required="yes">
    <cfquery name="qRec" datasource="#THIS.dsn#">
    SELECT refTableau
    FROM Produits
    WHERE id=<cfqueryparam cfsqltype="cf_sql_integer"
    value="#ARGUMENT.idTableau#">
    </cfquery>
    <!--- Convert file to XML document object --->
    <cfset MyXmlCode=qRec.refTableau>
    <cfset mydoc = XmlParse(MyXmlCode)>
    <cfset numItems =
    ArrayLen(mydoc.table.tr.XmlChildren)>
    <cfset numLines = ArrayLen(mydoc.table.XmlChildren)>
    <!--- Process the order into a query object --->
    <cfset listHeader="">
    <cfloop from="1" to="#numItems#" index="i">
    <cfset listHeader=ListAppend(listHeader, "Col_#i#")>
    </cfloop>
    <cfset queryDatas = QueryNew(listHeader)>
    <cfset temp = QueryAddRow(queryDatas, numLines)>
    <cfloop index="i" from="1" to ="#numLines#">
    <cfloop from="1" to="#numItems#" index="j">
    <cfset temp = QuerySetCell(queryDatas,
    ListGetAt(listHeader, j), mydoc.table.tr
    .td[j].XmlText, i)>
    </cfloop>
    </cfloop>
    <cfquery name="qReturn" dbtype="query">
    SELECT *
    FROM queryDatas
    <cfif ARGUMENTS.gridsortcolumn neq "" or
    ARGUMENTS.gridsortdirection neq "">
    ORDER BY #ARGUMENTS.gridsortcolumn#
    #ARGUMENTS.gridsortdirection#
    </cfif>
    </cfquery>
    <cfreturn QueryConvertForGrid(qReturn, ARGUMENTS.page,
    ARGUMENTS.pageSize)>
    </cffunction>
    <cffunction name="editData" access="remote"
    output="false">
    <cfargument name="gridaction">
    <cfargument name="gridrow">
    <cfargument name="gridchanged">
    </cffunction>
    </cfcomponent>
    <body>
    I don't understand why the return is empty.

    I have the same problem. When the function is removed, the
    query return many line of data, but when the queryconverforgrid is
    added, the grid has the same number of line but all fields are
    empty. Can someone please help???

  • How to create cfc for this give solution

    <cfcomponent>
    <cffunction 
    name="doc" access="remote" returntype="Any" >
     <cfargument name="profile_id" type="any" required="true" default="" >
     <cfargument name="search_primary_storage_profile_id_only" type="numeric" required="true" >
     <cfargument name="from_where" type="string" required="true" >
     <cfargument name="from_where_response_mode" type="string" required="true" >
     <cfargument name="setting_sec_document_access_rights" type="numeric" required="true" >
     <cfargument name="customer_name_number_srch" type="any" required="true" >
     <cfargument name="file_or_folder_name_srch" type="string" required="true" >
     <cfargument name="file_extension_srch" type="string" required="true" >
     <cfargument name="document_create_dat_start_srch" type="any" required="true" >
     <cfargument name="document_create_dat_end_srch" type="any" required="true" >
     <cfargument name="dsi_yyyy" type="any" required="true" >
     <cfargument name="dsi_emp_fname" type="any" required="true" >
     <cfargument name="dsi_emp_lname" type="any" required="true">
     <cfargument name="dsi_emp_id" type="any" required="true">
     <cfargument name="dsi_filename_original" type="any" required="true" >
     <cfargument name="dsi_document_type" type="any" required="true" >
     <cfargument name="dsi_file_label" type="any" required="true" >
     <cfargument name="dsi_document_group" type="any" required="true" >
     <cfargument name="dsi_document_expiration_dat" type="any" required="true" >
     <cfargument name="order_by_1" type="any" required="true" >
     <cfargument name="order_by_1_asc_desc" type="any" required="true" >
     <cfargument name="order_by_2" type="any" required="true" >
     <cfargument name="order_by_2_asc_desc" type="any" required="true" >
     <cfargument name="Search" type="any" required="true" >
     <cfargument name="document_ocr_full_text_srch" type="any" required="true" >
     <cfargument name="and_or_setting" type="any" required="true" >
     <cfargument name="setting_search_ocr_type" type="any" required="true" default="1">
     <cfargument name="document_ocr_full_text_rank" type="any" required="true" >
     <cfset  form.profile_id=profile_id><cfset 
    form.search_primary_storage_profile_id_only=search_primary_storage_profile_id_only><cfset 
    form.from_where=from_where><cfset 
    form.from_where_response_mode=from_where_response_mode><cfset 
    form.setting_sec_document_access_rights=setting_sec_document_access_rights><cfset 
    form.customer_name_number_srch=customer_name_number_srch><cfset 
    form.file_or_folder_name_srch=file_or_folder_name_srch><cfset 
    form.file_extension_srch=file_extension_srch><cfset 
    form.document_create_dat_start_srch=document_create_dat_start_srch><cfset 
    form.document_create_dat_end_srch=document_create_dat_end_srch><cfset 
    form.dsi_yyyy=dsi_yyyy><cfset 
    form.dsi_emp_fname=dsi_emp_fname><cfset 
    form.dsi_emp_lname=dsi_emp_lname><cfset 
    form.dsi_emp_id=dsi_emp_id><cfset 
    form.dsi_filename_original=dsi_filename_original><cfset 
    form.dsi_document_type=dsi_document_type><cfset 
    form.dsi_file_label=dsi_file_label><cfset 
    form.dsi_document_group=dsi_document_group><cfset 
    form.dsi_document_expiration_dat=dsi_document_expiration_dat>
     <cfset  form.order_by_1=order_by_1><cfset 
    form.order_by_1_asc_desc=order_by_1_asc_desc><cfset 
    form.order_by_2=order_by_2><cfset 
    form.order_by_2_asc_desc=order_by_2_asc_desc>
     <cfset  form.Search=Search><cfset 
    form.document_ocr_full_text_srch=document_ocr_full_text_srch><cfset 
    form.and_or_setting=and_or_setting><cfset 
    form.setting_search_ocr_type=setting_search_ocr_type><cfset 
    form.document_ocr_full_text_rank=document_ocr_full_text_rank>
     <cfinclude template="#application.ist_environment.ist_auth#logon/logon_status.cfm">
    <!--- Access parameters --->
     <cfset nf5.mpf = 27>
     <cfinclude template="#application.ist_environment.ist_auth#logon/logon_load_my_auth_access_variables.cfm">
    <!--- Access parameters --->
     <cfinclude template="#application.ist_environment.ist_shared#/ist_display/body_main.cfm">
    <!--- Get profiles and indexed keys --->
     <cfquery name="get_active_profiles" datasource="#request.ds.docstor#" cachedwithin="#createtimespan(0,0,5,0)#">
     SELECT storage_profile_id, storage_profile_name 
    FROM storage_profile_attributes 
    WHERE storage_profile_active = 1 
    ORDER BY storage_profile_name, storage_profile_id desc  
    </cfquery>
     <cfquery name="get_indexes" datasource="#request.ds.docstor#" cachedwithin="#createtimespan(0,0,5,0)#">
     SELECT distinctml.storage_profile_key_id,
    ml.spk_name,
    ml.spk_key,
    r.spr_desc,
    ml.datatype,
    ml.local_type_name,
    ml.p1,
    ml.p2,
    ml.has_options_list
    FROM storage_profile_variables_master_list as ml 
    LEFT JOIN storage_profile_rule_by_profile as r 
    ON ml.storage_profile_id = r.storage_profile_id 
    and ml.storage_profile_key_id = r.storage_profile_key_id 
    WHERE storage_profile_key_isIndexed = 1 
    <cfif val(form.profile_id)>
     and ml.storage_profile_id = #val(form.profile_id)# 
    <cfelse>
     and 1 = 0 
    </cfif>
    <!--- <cfreturn profile_id>--->
    <!---<cfreturn form.dsi_yyyy>--->
     </cfquery>
    <!--- Get profiles and indexed keys --->
     <cfif isdefined("form.profile_id")>
     <cfquery name="QoQ_storage_profile_key_options" datasource="#request.ds.docstor#">
     SELECT spko_value, storage_profile_key_id, storage_profile_id 
    FROM storage_profile_key_options 
    WHERE storage_profile_id = #val(form.profile_id)#  
    </cfquery>
     <cfparam name="application.storageProfileTable.sp#val(form.profile_id)#.exists" default="0">
     <cfscript>
     if(val(form.profile_id) gt 0){
    //application.storageProfileTable["sp#val(form.profile_id)#"]["pop"] = 0;
    if(application.storageProfileTable["sp#val(form.profile_id)#"]["exists"] neq 1 or application.storageProfileTable["sp#val(form.profile_id)#"]["pop"] eq 0){
    if(not isdefined("application.cfc.cfcDocstor_search_profile_table_build") or not isCustomFunction(application.cfc.cfcDocstor_search_profile_table_build)){application.cfc.cfcDocstor_search_profile_table_build =
    CreateObject("component","ist_business_applications.ist_docstor.search.docstor_search_profile_table_build");} 
    // Update the denormalized document index tables
    args =
    structnew();args.storage_profile_id =
    val(form.profile_id);// If focused_document_id_list is empty then the system will pick up any edits that need to be made
    args.focused_document_id_list =
    "";args.maxrows =
    500;application.storageProfileTable[
    "sp#val(form.profile_id)#"]["pop"] = 0;application.cfc.cfcDocstor_search_profile_table_build.fnVerifyStorageProfileTable(args.sto rage_profile_id, args.focused_document_id_list, args.maxrows);
    </cfscript>  
    </cfif>
    <!---<cfparam name="form.and_or_setting" default="and">
    <cfparam name="form.file_or_folder_name_srch" default="">
    <cfparam name="form.customer_name_number_srch" default="">
    <cfparam name="form.document_create_dat_start_srch" default="">
    <cfparam name="form.document_create_dat_end_srch" default="">
    <cfparam name="form.file_extension_srch" default="">--->
     <cfparam name="form.search_primary_storage_profile_id_only" default="1">
     <cfparam name="current_storage_profile_name" default="None Selected">
    <!--- Search Options --->
    <!--- Other inputs --->
     <cfparam name="session.ds_search.and_or_setting" default="and">
     <cfparam name="session.ds_search.customer_name_number_srch" default="">
     <cfparam name="session.ds_search.file_or_folder_name_srch" default="">
     <cfparam name="session.ds_search.document_create_dat_start_srch" default="">
     <cfparam name="session.ds_search.document_create_dat_end_srch" default="">
     <cfparam name="session.ds_search.file_extension_srch" default="">
     <cfparam name="session.ds_search.setting_search_ocr_type" default="1">
     <cfparam

    <cfcomponent>
    <cffunction 
    name="doc" access="remote" returntype="Any" >
     <cfargument name="profile_id" type="any" required="true" default="" >
     <cfargument name="search_primary_storage_profile_id_only" type="numeric" required="true" >
     <cfargument name="from_where" type="string" required="true" >
     <cfargument name="from_where_response_mode" type="string" required="true" >
     <cfargument name="setting_sec_document_access_rights" type="numeric" required="true" >
     <cfargument name="customer_name_number_srch" type="any" required="true" >
     <cfargument name="file_or_folder_name_srch" type="string" required="true" >
     <cfargument name="file_extension_srch" type="string" required="true" >
     <cfargument name="document_create_dat_start_srch" type="any" required="true" >
     <cfargument name="document_create_dat_end_srch" type="any" required="true" >
     <cfargument name="dsi_yyyy" type="any" required="true" >
     <cfargument name="dsi_emp_fname" type="any" required="true" >
     <cfargument name="dsi_emp_lname" type="any" required="true">
     <cfargument name="dsi_emp_id" type="any" required="true">
     <cfargument name="dsi_filename_original" type="any" required="true" >
     <cfargument name="dsi_document_type" type="any" required="true" >
     <cfargument name="dsi_file_label" type="any" required="true" >
     <cfargument name="dsi_document_group" type="any" required="true" >
     <cfargument name="dsi_document_expiration_dat" type="any" required="true" >
     <cfargument name="order_by_1" type="any" required="true" >
     <cfargument name="order_by_1_asc_desc" type="any" required="true" >
     <cfargument name="order_by_2" type="any" required="true" >
     <cfargument name="order_by_2_asc_desc" type="any" required="true" >
     <cfargument name="Search" type="any" required="true" >
     <cfargument name="document_ocr_full_text_srch" type="any" required="true" >
     <cfargument name="and_or_setting" type="any" required="true" >
     <cfargument name="setting_search_ocr_type" type="any" required="true" default="1">
     <cfargument name="document_ocr_full_text_rank" type="any" required="true" >
     <cfset  form.profile_id=profile_id><cfset 
    form.search_primary_storage_profile_id_only=search_primary_storage_profile_id_only><cfset 
    form.from_where=from_where><cfset 
    form.from_where_response_mode=from_where_response_mode><cfset 
    form.setting_sec_document_access_rights=setting_sec_document_access_rights><cfset 
    form.customer_name_number_srch=customer_name_number_srch><cfset 
    form.file_or_folder_name_srch=file_or_folder_name_srch><cfset 
    form.file_extension_srch=file_extension_srch><cfset 
    form.document_create_dat_start_srch=document_create_dat_start_srch><cfset 
    form.document_create_dat_end_srch=document_create_dat_end_srch><cfset 
    form.dsi_yyyy=dsi_yyyy><cfset 
    form.dsi_emp_fname=dsi_emp_fname><cfset 
    form.dsi_emp_lname=dsi_emp_lname><cfset 
    form.dsi_emp_id=dsi_emp_id><cfset 
    form.dsi_filename_original=dsi_filename_original><cfset 
    form.dsi_document_type=dsi_document_type><cfset 
    form.dsi_file_label=dsi_file_label><cfset 
    form.dsi_document_group=dsi_document_group><cfset 
    form.dsi_document_expiration_dat=dsi_document_expiration_dat>
     <cfset  form.order_by_1=order_by_1><cfset 
    form.order_by_1_asc_desc=order_by_1_asc_desc><cfset 
    form.order_by_2=order_by_2><cfset 
    form.order_by_2_asc_desc=order_by_2_asc_desc>
     <cfset  form.Search=Search><cfset 
    form.document_ocr_full_text_srch=document_ocr_full_text_srch><cfset 
    form.and_or_setting=and_or_setting><cfset 
    form.setting_search_ocr_type=setting_search_ocr_type><cfset 
    form.document_ocr_full_text_rank=document_ocr_full_text_rank>
     <cfinclude template="#application.ist_environment.ist_auth#logon/logon_status.cfm">
    <!--- Access parameters --->
     <cfset nf5.mpf = 27>
     <cfinclude template="#application.ist_environment.ist_auth#logon/logon_load_my_auth_access_variables.cfm">
    <!--- Access parameters --->
     <cfinclude template="#application.ist_environment.ist_shared#/ist_display/body_main.cfm">
    <!--- Get profiles and indexed keys --->
     <cfquery name="get_active_profiles" datasource="#request.ds.docstor#" cachedwithin="#createtimespan(0,0,5,0)#">
     SELECT storage_profile_id, storage_profile_name 
    FROM storage_profile_attributes 
    WHERE storage_profile_active = 1 
    ORDER BY storage_profile_name, storage_profile_id desc  
    </cfquery>
     <cfquery name="get_indexes" datasource="#request.ds.docstor#" cachedwithin="#createtimespan(0,0,5,0)#">
     SELECT distinctml.storage_profile_key_id,
    ml.spk_name,
    ml.spk_key,
    r.spr_desc,
    ml.datatype,
    ml.local_type_name,
    ml.p1,
    ml.p2,
    ml.has_options_list
    FROM storage_profile_variables_master_list as ml 
    LEFT JOIN storage_profile_rule_by_profile as r 
    ON ml.storage_profile_id = r.storage_profile_id 
    and ml.storage_profile_key_id = r.storage_profile_key_id 
    WHERE storage_profile_key_isIndexed = 1 
    <cfif val(form.profile_id)>
     and ml.storage_profile_id = #val(form.profile_id)# 
    <cfelse>
     and 1 = 0 
    </cfif>
    <!--- <cfreturn profile_id>--->
    <!---<cfreturn form.dsi_yyyy>--->
     </cfquery>
    <!--- Get profiles and indexed keys --->
     <cfif isdefined("form.profile_id")>
     <cfquery name="QoQ_storage_profile_key_options" datasource="#request.ds.docstor#">
     SELECT spko_value, storage_profile_key_id, storage_profile_id 
    FROM storage_profile_key_options 
    WHERE storage_profile_id = #val(form.profile_id)#  
    </cfquery>
     <cfparam name="application.storageProfileTable.sp#val(form.profile_id)#.exists" default="0">
     <cfscript>
     if(val(form.profile_id) gt 0){
    //application.storageProfileTable["sp#val(form.profile_id)#"]["pop"] = 0;
    if(application.storageProfileTable["sp#val(form.profile_id)#"]["exists"] neq 1 or application.storageProfileTable["sp#val(form.profile_id)#"]["pop"] eq 0){
    if(not isdefined("application.cfc.cfcDocstor_search_profile_table_build") or not isCustomFunction(application.cfc.cfcDocstor_search_profile_table_build)){application.cfc.cfcDocstor_search_profile_table_build =
    CreateObject("component","ist_business_applications.ist_docstor.search.docstor_search_profile_table_build");} 
    // Update the denormalized document index tables
    args =
    structnew();args.storage_profile_id =
    val(form.profile_id);// If focused_document_id_list is empty then the system will pick up any edits that need to be made
    args.focused_document_id_list =
    "";args.maxrows =
    500;application.storageProfileTable[
    "sp#val(form.profile_id)#"]["pop"] = 0;application.cfc.cfcDocstor_search_profile_table_build.fnVerifyStorageProfileTable(args.sto rage_profile_id, args.focused_document_id_list, args.maxrows);
    </cfscript>  
    </cfif>
    <!---<cfparam name="form.and_or_setting" default="and">
    <cfparam name="form.file_or_folder_name_srch" default="">
    <cfparam name="form.customer_name_number_srch" default="">
    <cfparam name="form.document_create_dat_start_srch" default="">
    <cfparam name="form.document_create_dat_end_srch" default="">
    <cfparam name="form.file_extension_srch" default="">--->
     <cfparam name="form.search_primary_storage_profile_id_only" default="1">
     <cfparam name="current_storage_profile_name" default="None Selected">
    <!--- Search Options --->
    <!--- Other inputs --->
     <cfparam name="session.ds_search.and_or_setting" default="and">
     <cfparam name="session.ds_search.customer_name_number_srch" default="">
     <cfparam name="session.ds_search.file_or_folder_name_srch" default="">
     <cfparam name="session.ds_search.document_create_dat_start_srch" default="">
     <cfparam name="session.ds_search.document_create_dat_end_srch" default="">
     <cfparam name="session.ds_search.file_extension_srch" default="">
     <cfparam name="session.ds_search.setting_search_ocr_type" default="1">
     <cfparam

  • URL. variable persisting across submit()

    Hi,
    I have a wierd problem that affects only one script of dozens
    that use the same technique.
    I have apage with two forms. The first form displays a select
    lisst of players in our basketball club. When selecting a player
    the page is reloaded using onChange='document.players.submit();'.
    The second form contains all the players details, and when
    you press update button, it calls another script which then updates
    the players details and returns to the original script.
    To ensure the updated user row is loaded the first script
    passes the players id to the second script, which in turn passes it
    back after the update.
    A check is done to see if an incoming URL variable is
    present.
    As long as I don't update any player records URL.players
    never exists
    If I update a player URL.player exists, as it should, but
    then persists for every submit() from that point onwards, and it
    only happens in this one script, such that I can never load another
    player record unless I exist the script and go back in.
    Any ideas?

    This is the whole section of code. I already had
    method="post". Sorry about the >/cfoutput> it's not actually
    in the code.
    <cfquery name="players"
    Datasource="#Application.Datasource#">
    select users.uid_user,full_name from
    users, user_roles
    where user_roles.uid_role=3 and
    user_roles.uid_user=users.uid_user
    <cfif #session.sequence# is True>
    order by first_name, last_name
    <cfelse>
    order by last_name, first_name
    </cfif>
    </cfquery>
    <!--- When coming back after a change, remember which user
    was selected. --->
    <cfif isDefined('URL.players')>
    <cfset FORM.players=#URL.players#>
    <cfelse>
    <cfif Not isDefined('FORM.players')>
    <cfset FORM.players=#players.uid_user#>
    </cfif>
    </cfif>
    <!--- Load the player account --->
    <cfquery name="get_player"
    datasource="#Application.datasource#">
    select * from players where uid_user=#FORM.players#
    </cfquery>
    <!--- Display the form --->
    <cfform name="players" method="post" action="">
    <table width="652" border="0" cellspacing="0"
    cellpadding="5">
    <tr class="PageText">
    <td width="127"><div
    align="right">Member:</div></td>
    <td width="408">
    <cfselect name="players"
    Query="players"
    display="full_name"
    value="uid_user"
    size="1"
    required="yes"
    multiple="no"
    selected="#FORM.players#"
    passthrough="onchange='document.players.submit();'">
    </cfselect></td>
    </tr>
    </table>
    </cfform>
    The second half of the page contains all the player details
    for the user to edit. The form statement for this is..
    <cfform name="def_player" method="post"
    action="change_player2.cfm?players=#FORM.players#">
    When change_player2.cfm returns to change_player.cfm...
    <cflocation
    url="change_player.cfm?players=#URL.players#">
    This all used to work fine, but has stopped recently. This
    was the first script this happened to. Now I;ve found another one.
    In this case, selcting users from the drop down doesn't work at all
    - it juest keeps reloading the first user in the table.
    I was wondering if this might be server related, so I tried
    the version on the production server, which is externally hosted.
    Same problem. I uploaded the code as you see it above and tried
    again, same problem.
    thanks

  • Finding numbers in recordset.

    Easy one for the experienced guys:
    I have a record with a list of comma separated values, IE,
    1,2,4,6,12,24
    or simply
    24
    I need to write a query where I find all records where the
    specific number/value I'm looking for is in the list. For example
    I’m looking for all records that contains the number "2".
    I've used the like operator
    select * from my_table where my_column like
    '%#form.my_search#%'
    (and a few variants), but the problem is, it finds the record
    with just "24" in it as well, whereas I want records that contains
    "2". And not anything that has a 2 in front or behind it.
    All numbers are integers, as they refer to a row identifier
    on another table.
    How to do this?
    Thanks

    Though I agree with comments here about normalizing
    databases, if you are stuck with this, here is a solution. A query
    of a query. Converts your 1,2,3,4,5,6 to '1','2','3','4','5','6'
    which can then be used with the SQL operator IN.
    <!--- Make sure your search parameter is surrounded by
    single quotes, then surrounded by double quotes --->
    <cfset Form.search = "'2'">
    <cfquery name="q1" datasource="yourDatasource">
    select * , '''' + REPLACE(csv_data,',',''',''') + '''' as
    mod_data,
    '#Form.search#' as search_parm
    from test
    </cfquery>
    <cfquery dbtype="query" name="q2">
    select * from q1
    where search_parm IN (mod_data)
    </cfquery>
    <cfoutput query="q2">
    #anyColumnYouSelectedInQuery1or2#<br>
    </cfoutput>

  • Syncronizing Three Dynamic List boxes

    I have three list boxes which are populated by cfquerys. If
    the first one changes the other two must change.
    If the second changes the third one has to change and the
    first one stay the same.
    I submit the form to inself each time the the boxes are
    clicked. I'm using javascript to set the action to the same page
    each time. I have it working if I change the first list box but not
    when I change the second list box. Thanks in advance.
    Here is the code for the first, second and third list box and
    the java script.
    <td><select name="site"
    onchange="submitForm('selected');">
    <cfoutput query="qGetMarketSites">
    <option value="#qGetMarketSites.site#"
    <cfif form.site eq #qGetMarketSites.site#>
    selected
    </cfif>
    >#qGetMarketSites.market#
    </option>
    </cfoutput>
    </select>
    </td>
    <td><select name="city" size="1" onchange="
    <cfset form.prevSite=form.site/>;
    submitForm('selected');">
    <cfoutput query="qGetCitys">
    <option value="#qGetCitys.city#"
    <cfif form.city eq #qGetCitys.city#>
    selected
    </cfif>
    >#qGetCitys.city#
    </option>
    </cfoutput>
    </select>
    </td>
    <td><select name="npanxx" size="1"
    onchange="submitForm('selected');">
    <cfoutput query="qGetNPANXXS">
    <option value="#qGetNPANXXS.npanxx#"
    <cfif form.npanxx eq #qGetNPANXXS.npanxx#>
    selected
    </cfif>>#qGetNPANXXS.npanxx#
    </option>
    </cfoutput>
    </select>
    </td>
    <script type="text/JavaScript">
    function submitForm(submitFrom)
    if (submitFrom == 'selected')
    alert(document.form.site.value);
    alert(document.form.prevSite.value);
    document.form.action="getAssignment2.cfm";
    form.submit();
    else
    _CF_checkform(document.form);
    if (_CF_error_exists == false)
    if (document.form.port_Indicator[1].checked)
    if (document.form.foreign_DN.value == " ")
    alert('Foreign DN must be populated');
    else
    document.form.action="selectInventory.cfm";
    form.submit();
    else
    document.form.action="selectInventory.cfm";
    form.submit();
    //-->
    </script>

    hai,
    here is the sample code.
    write it in onchange of list1.
    var a1=document.form.list1.selectedIndex;
    for(i=0;i<document.form.list1.length;i++)
    if(i!=a1)
    document.form.list2.options=new Option(document.form.list1.options[i],document.form.list1.options[i],false,false);
    else
    i--;
    i think this may help u out.
    regards,
    ravi

Maybe you are looking for

  • BOBJ 6.5 - Infoview - Decimals Changing between PDF and HTML view

    HI, We have an issue with report generated in Webi 6.5.with figures shown to 2 decimal places. When viewed in HTML the figures are displayed correctly e,g, 7.8. When viewed in PDF format, the decimal point moves on random figures e.g. 8.7 This is suc

  • How do I create a bleed for an irregular shaped vector?

    I am trying to make stickers. I have created a few images (vectors), added cutlines but i have no idea how to add a bleed to the outer edge of the image to prevent "white space" when the printer cuts it out. I am using CS2 and i am a noobie. Please c

  • Repair my screen questions

    I got 2 white spots underneath the screen on the left side and a thing that looks like dust on the bottom right. Theres a pixel flipping out on the left side, and theres also a pixel size white dot on the black edge of the screen ( weird). Also a yel

  • Gen 4 Nano - Backlight not coming on

    I've got a Gen 4 Nano that is about 2 months old. The backlight is not coming on. I've gone into the settings and made sure that it's set to some length of time (5 sec, 10 sec, 30 sec) none of which work. I've also done the recommended reset and have

  • Accessing directories of ical server

    Hello I'm trying to get a CRM program to interact with the ICAL server, and hope to be able to write and read directly from the directories containing the information. So in theory drop a webcal object in, read a webcal object out. However.. even as