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

  1. #1

    Default passing varible

    How do I pass the automatic name from page to page to find out the value. Here
    is my explanation.
    I have index.cfm with all the radio boxes for YES/ NO and it associated with
    the ID from the database. On the next page, I want able to track down which ID
    selected YES and which ID selected NO in order to send out the email to them.
    index.cfm
    =================
    <form action="next.cfm" method="post">
    <input type="radio" name="vip_#id#" value="1" >YES
    <input type="radio" name="vip_#id#" value="0" checked">NO
    </form>

    next.cfm
    =================
    <cfoutput>#???#</cfoutput>
    thanks

    kt03 Guest

  2. Similar Questions and Discussions

    1. Varible clearance, mouse/keyboard
      I seem to be having problems with my login scripts. I have mentioned this here before, but have some more ideas i would like to run past you all....
    2. Onlick and Passing varible
      I have the page: one textbox, one button using Onclick. User enter name from textbox then click "Go button", pop-up page open and display name. I...
    3. Simple varible wont work&#33;
      Hey heres the code: <? if (xbt = 1) { ?> <tr><Td colspan=2><center>The STATS are from the XBT tracker we run as the backend of the...
    4. Varible Problem
      Hi, I have a problem with the structure of my website which is causing problem with passing variables between functions, even when declared as...
    5. Seting A Flash Varible with a URL
      Hey all, I posted this question to data_intergration and got no responce, thought this might be a better forum for it. I need to set a varible...
  3. #2

    Default Re: passing varible

    <cfoutput>#YesNoFormat(Form["vip_#id#"])#</cfoutput>

    The key here is that form variables can be accessed as structures (as of CFMX,
    they actually are structures.So, Form["field"] is the equivalent of Form.field.
    This is especially helpful in situations like yours where you need to get a
    dynamically named field.

    So, to get a field named "vip_#id#", you use Form["vip_#id#"]

    SteveBryant Guest

  4. #3

    Default Re: passing varible

    Unlike <INPUT TYPE="text">, radio buttons that are unchecked are not available
    as FORM fields on next.cfm. So you will have to use the IsDefined( ) function
    before you try to process them.

    Also, there is a FORM field called "fieldnames" that is a comma-delimited list
    of FORM fields that have been submitted. So you can set up a list loop over
    fieldnames, search for the next occurrence of "vip_" using the ListContains( )
    function and use that list element as the radio button's variable name. You
    will have to use the Evaluate( ) function to obtain it's value.

    Hope this helps.

    jdeline Guest

  5. #4

    Default Re: passing varible

    SteveBryant ,

    Yes, I try your <cfoutput>Form["vip_#id#"]</cfoutput>, but all I got pass over
    just name not value such as:
    id: Form["vip_278,279,280,281,282"]
    I want to able to find out which id was selected NO and which id was selected
    YES

    Thanks

    kt03 Guest

  6. #5

    Default Re: passing varible

    Hi KT

    Try this................

    index.cfm
    =================
    <form action="next.cfm" method="post">
    <input type=hidden name=id value="#id#">
    <input type="radio" name="vip_#id#" value="1" >YES
    <input type="radio" name="vip_#id#" value="0" checked">NO
    </form>

    next.cfm
    =================
    <cfset id=form.id>
    <cfset vipID=Form["vip_#id#"]>
    <cfoutput>#vipID#</cfoutput>



    reenaroy Guest

  7. #6

    Default Re: passing varible

    You have a few choices here:

    1) Dont pass the id in the form. Instead, on the action page, loop over the
    same query that you used on the form page.

    2) Use the form as reenaroy suggested (which is probably what you are doing)
    and take advantage of the id being passed as a list by using list functions:

    <cfoutput>
    <cfloop index="thisID" list="#Form.id#">
    <cfif StuctKeyExists(Form,"vip_#thisID#")>
    #YesNoFormat(Form["vip_#thisID#"])#<br/>
    </cfif>
    </cfloop>
    </cfoutput>

    Make sense?

    SteveBryant Guest

  8. #7

    Default Re: passing varible

    reenaroy ,

    I tried your code and I got this error below:

    Element vip_278,279,280,281,282 is undefined in a Java object of type class coldfusion.filter.FormScope referenced as

    Thanks
    kt03 Guest

  9. #8

    Default Re: passing varible

    SteveBryant ,

    I tried your sugessted and I got this error: Variable STUCTKEYEXISTS is undefined. Where do I get STUCTKEYEXISTS ?

    Thanks
    kt03 Guest

  10. #9

    Default Re: passing varible

    Sorry about that. It should have been StructKeyExists.

    Hopefully that was my only type.

    Sorry for the trouble.
    SteveBryant Guest

  11. #10

    Default Re: passing varible

    SteveBryant ,

    I thought that too, I corrected that after I posted the message and it worked.

    Thanks a lot
    kt03 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