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!

Similar Messages

  • JSP : create variable dynamic variable name and get his value.

    //HI forums.sun.com !
    //What I want to do is above :
    //out.println("<td style=\"width: "+col_width_+h+" \">")
    //Variable Declaration
    String col_width_1 = "100px";
    String col_width_2 = "150px";
    //etc String col_width_N = "XXXpx";
    //loop
    for (int h = 0; h < hrecset.getRowCount(); h++)
    //some code
    //create the variable name (exemple : col_width_0 ) with the "loop counter name" to get the value
    out.println("<td style=\"width: "+col_width_+h+" \">")//Do you understand what i mean?
    //some code
    //Variable Declaration
    String col_width_1 = "100px";
    String col_width_2 = "150px";
    //etc String col_width_N = "XXXpx";
    //loop
    for (int h = 0; h < hrecset.getRowCount(); h++)
    //some code
    //create the variable name with a concat with the loop counter variable name to get the value of the concatened variable
    out.println("<td style=\"width: "+col_width_+h+" \">")//Do you understand what i mean?
    //some code

    I apologize
    1) Sure i understand it but i click on the "code" button after i inserted the text above but it doesn't worked now it do.
    2) Because the table element need to have the total width in the HTML table TAG equal to the addition of every HTML td TAG to be W3 conform
    because i have a lot of cell where i want to adjust the width.
    so here my solution
    <%
    //Variable für Breite
    String col_width_unit = "px"; // px, cm,
    Integer total_table_width = 0;
    String[] col_width=new String[3];
    col_width[0] =  "350";
    col_width[1] =  "75";
    col_width[2] =  "50";
    %>
    <table style="page-break-inside:avoid;width:<%=gesamt_table_width+col_width_unit%>;">
    <%
    for (int h = 0; h < hrecset.getRowCount(); h++)
    out.println("               <td id =\"cell"+h+"\" class=\"tdall\"  style=\"width:"+col_width[h]+col_width_unit+"\" >");               
    %>
    </table>thank you very much

  • Creating dynamic variable names

    I know there has got to a way to do this but I am not finding anything on google. I want to create a dynamic variable name like name + i so when your in a loop the names come out name1, name2 and so on till however many you want. I have tried
    int name + i = 3;
    int name[i] = 3; // which obviously won't but I had to try
    int name{i} = 3;and I am out of ideas. Thanks for all your help.

    I'd suggest using variables named j or x when posting code which uses them as array indexes.
    [i] - is for italics formatting
    [u] - is for underlined formatting
    [code] is for class Example { ... } code formatting
    etc.

  • Dynamic Variable Names

    Okay, I just need to figure out how to make dynamic variable
    names. In this case, I have a loop, and inside the loop I need to
    create a new array for every iteration of the loop. Something like
    <cfloop from="0" to="10" index="i">
    <cfset LoopArray#i# = Some Value>
    </cfloop>
    But that doesn't work. How can you make dynamic variable
    named? I think it's probably something to do with evaluate or DE,
    but I don't know how to use them, and the livedocs make no sense to
    me. Thanks!

    On Thu, 22 May 2008 17:14:42 +0000 (UTC), kenji776 wrote:
    > Thank you both for your replied, I did manage to find a
    solution (the same one
    > posted by JR "Bob" Dobbs). Pretty much just looks
    like...
    >
    >
    > <cfloop from="1" to="3" index="i">
    > <cfset LinkResults["#i#"][1] = "Player 1's Move
    ID">
    > <cfset LinkResults["#i#"][2] = "Player 2's Move
    ID">
    > <cfset LinkResults["#i#"][3] = "Damage to player
    1">
    > <cfset LinkResults["#i#"][4] = "Damage to player
    2">
    > </cfloop>
    From your values, you don't want a two-dimensional array
    (which although
    you're actually building LinkResults as a struct, with the
    sequential
    numeric keys, it's basically an array), you want an array of
    structs, eg:
    LinkResults
    .player1.moveId
    LinkResults.player1.damage
    What is "i" actually counting through? IE: from 1-3 things...
    which are...
    what?
    Adam

  • Dynamic Variable Names in OpenScript

    Is there a way to use dynamic variable names? What I mean by this is that the variable name in the file could be:
    Name1, Name2, Name3, etc.
    I may want to loop through these by saying something like:
    For i = 0; i < iLoop; i++
    String sFieldName = "{{ViewList.Name" + Integer.toString(i) + "}}";
    JOptionPane.showMessageDialog(null, "sFieldName: " + "{{ViewList.{{sFieldName}}}}");
    I don't want it to use the literal string of {{ViewList.Name1}}, but rather, I want to use the value from the DataBank for Name1. Thanks.
    -John

    Nishanth,
    Thanks for your suggestion. Unfortunately, this is not a simple variable replacement. I want the name of the variable to be dynamic in nature. Imagine that I have 5 variables in the files named:
    Name
    FoodPref1
    FoodPref2
    FoodPref3
    FoodPref4
    I would like to loop through these and construct the variable name dynamically so it would be something similar to:
    for i=1 to 4; i++
    sFoodPrefVar = "FoodPref" + i;
    getVariables().set("FoodPref",sFoodPrefVar);
    JOptionPane.showMessageDialog(null, "Your Food Pref is: " + {{FoodPref}} + "\n");
    This is pseudo code, but it would theoretically loop through the 4 food preferences. Thanks.
    -John

  • Dynamic File Name and File size

    Hi All
    I need some help in calling Dynamic File Name and Dynamic File size of a file in my adapter Module.
    Could you please provided some help on the same?
    I have tried the same through UDF it is working. Could anyone provide me the steps for the same
    Regards
    Abhishek Mahajan

    Hi,
    You can use the already available adapter module "DynamicConfigurationBean". Have this adapter module at the top of the module list in CC.
    Have the parameter value as insert http://sap.com/xi/XI/System/File FileName and http://sap.com/xi/XI/System/File SourceFileSize (corresponding to the key names)
    For more info:
    http://help.sap.com/saphelp_nw04/helpdata/en/45/da2239feb22e98e10000000a155369/frameset.htm
    There is also a SAP note available for the same....dont remember the note number:(.....
    Regards,
    Abhishek.

  • Dynamic variable name

    Hi for all.
    I'm need create a object with "dynamic" name. For example
    Object ABCi = new ...
    where i is a indice.
    Please, help-me

    >
    Object ABC[] = new Object [size];
    for (int i=0; i<size;i++) {
    ABC[i] = ....
    }if you do something like this. How do you call one of the instances. How do you know how many there are??
    >
    Dynamic variable name? You're just making problems for
    yourselfIs there a better way? Because sometimes you have to have something like the above. Why is it a big problem?
    Thanks
    Brian

  • Table name ? with query name , variable name and variant .

    Hi All,
    Is there any single table with fields as query name , variable name and variant ?
    or any table which i can build a view to get these fields.
    or any other way ?? to get this fields in single table
    Thanks,
    Ak

    Hi,
    first use the proper heading for a question.
    you want the query all details means technical name, variable and variable type use RSRTQ
    it will give total information of query.
    Bex related tables
    RSZELTDIR ----
    Directory of the reporting component elements
    RSZELTTXT ----
    Texts of reporting component elements
    RSZELTXREF  ---
    Directory of query element references .
    Thanks,
    Phani.

  • How to output variable names and units used in binary file

    My colleague will be giving me binary files (*.dat) generated from within LabView. There are over 60 variables (columns) in the binary output file. I need to know the variable names and units, which I believe he already has set up in LabView. Is there a way for him to output a file containing the variable name and unit, so that I'll know what the binary file contains? He can create an equivalent ASCII file with a header listing the variable name, but it doesn't list the units of each variable.
    As you can tell I am not a LabView user so I apologize if this question makes no sense.
    Solved!
    Go to Solution.

    Hi KE,
    an ASCII file (probably csv formatted) is just text - and contains all data that is (intentially) written to. There is no special function to include units or whatever!
    Your collegue has to save those information the same way he saves the names and the values...
    (When writing text files he could use WriteTextFile, FormatIntoFile, WriteToSpreadsheetFile, even WriteBinaryFile could be used...)
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • [svn:sb-sherlock] 13663: Improved javadoc, variable names, and comments for calcCheckBits().

    Revision: 13663
    Revision: 13663
    Author:   [email protected]
    Date:     2010-01-20 09:58:41 -0800 (Wed, 20 Jan 2010)
    Log Message:
    Improved javadoc, variable names, and comments for calcCheckBits().
    Also added an assertion to enforce a pre-condition on one input.
    r=etierney+
    tests: flex checkin tests
    Modified Paths:
        flex/sdk/sandbox/sherlock/modules/compiler/src/java/flex2/compiler/CompilerAPI.java

  • AS2 syntax and dynamic variable names

    Hi all,
    Trying to learn AS2 and hoping someone can help me by
    explaining the problems with the following sample code and what
    would be needed to make it work (i.e. to create dynamic variables
    and movie clips from an array).
    Thanks for your time!

    kglad: Thanks for the super-quick and tremendously helpful
    response! Much appreciated!
    A couple of quick follow-up questions:
    kglad wrote that "createEmptyMovieClip() returns a reference
    to the created movieclip".
    How would I use/access this reference?
    Also, in the updated code below, I have two issues:
    1. rolling over a movie clip yields "this is button
    undefined" rather than "this is button a" for example; and
    2. clicking on a movie clip outputs the result of the trace
    command for all four clips (in reverse order) rather than just the
    one clicked.
    Any insights into what I need to do differently? Thanks
    again!

  • Dynamic variable name generation

    Hi people,
    Is there any way of generating variable names dynamically in java in a loop? i.e.
    for(int i = 0; i<arrayLength; i++) {
    ArrayX.add(position, object)
    X++
    Where X is 0,1,2...etc. so i would have Array1 with something in it, Array2 with something in it, Array3 and so on.
    This is just a simple example but I've basically got an initial array of URL objects and then I want to call my getURL method on each link in my inital array and store the links associated to each initial URL in a different Array.
    Hope it makes sense, and i hope someone can help!
    Thanks in advance.

    Your example code is not clear to me (what is "position?"), and your description using URLs doesn't seem to need what you are asking for. I would be careful about using arrays - people sometimes use arrays when classes should be used.
    Anyway, I think you can get close to what you want by using a HashMap. You can use Strings as keys and the Strings would be "array01" "array02" etc.

  • Dynamic File Name and Directory File Sender Adapter

    Hello gurus,
    I have a question: Is there any way to make the File Name, and Directory Dynamic of a File Sender Communication Channel ?
    For example, taking it as a parameter from a Web Service Request.. (I mean, the only way with this would be a ccBPM). I don't exactly know if there is a way, I just thought about this.
    Please tell me if someone could make Dynamic these 2 parameters while picking a file.
    Regards,
      Juan

    oops,thought i was replying to the PgP question:)
    I think you should be able to achieve this via adapter module but i m not really sure how exactly it will be done .
    Thanks
    Aamir
    Edited by: Aamir Suhail on Jul 28, 2009 1:42 PM

  • Dynamic Variable name (for int/long) from a String variable

    Hi,
    I want to give a int/long variable name from a String.
    for ex.
    String str = lookup + "Id";
    lookup is a String variable coming from XML. Now, for instance lookup="name". So str = "nameId".
    Now I want to create a int/long variable by nameId.
    Could anybody tell me the way how to do. Please don't tell to use MAP.
    Edited by: Shah on Dec 5, 2007 3:26 PM

    Well you can't. Use a Map.
    The compiler translates variable names into slot numbers, either within an object or withing the local "stack frame" and these slot numbers are assigned names at compile time. No new slots can be created at run time. Java is not Basic.
    Reflection allows you to find existing field names and methods (not local variables), so it's possible to map, for example, XML attribute names to field names or setters in an object but the names have to be known at compile time.

  • [Custom Tags] Dynamic Variable Name // Spring MVC

    I am having a problem with a tag,
    i try to make a dynamic select tag that is reuseable, the problem is that my spring controller generates a model where i can access the list information for a select and that i have to pass this to the dynamic tag, the model could have different name, so it could be ${listitemsa} ${listitemsb} ${listitemsc} and i want to pass this list to my custom tag.
    i tried the following, but the problem is that the var is passed as a string and not the list, does anybody know how to do this?
    <tag:formfield-selectbox name="listA" path="prototypeForm.selectionA" list="${listitemsa} " />
    <tag:formfield-selectbox name="listB" path="prototypeForm.selectionB" list="${listitemsb} " />
    <tag:formfield-selectbox name="listC" path="prototypeForm.selectionC" list="${listitemsc} " />     
    <%@ tag body-content="scriptless" %>
    <%@ attribute name="name" required="true" %>
    <%@ attribute name="path" required="true" %>
    <%@ attribute name="list" required="false" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
    <%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %> 
    <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
    <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
    <spring:bind path="${path}">
         <c:if test="${status.error}">
              <span class="error">
                   <c:forEach items="${status.errorMessages}" var="error">
                        <c:out value="${error}"/>
                   </c:forEach>
              </span><br />
         </c:if>
         <label for="<c:out value="${status.expression}"/>">${name}: </label>
         <form:select path="${path}">
              <form:option value="-1" label="--Please Select--" />
              <form:options items="${list}" />
         </form:select>
    </spring:bind>

    I've sorted it. Here's the solution for anybody experiencing the same problem.
    The problem is with switching from Java 1.2.1 to Java 1.3.0_02. Custom tags are (as of the JSP 1.1 spec) JavaBean compnents, and the Introspector appears to work differently in different Java versions.
    Consider this example:
    public void setAbc(String abc){}
    public boolean getAbc(){}Since the setter method takes a String and the finder method returns a boolean, the 1.2 Introspector takes the property type to be String, and returns null as the finder name. Java 1.3 (I haven't tested this explicitely, but this is what seems to be happening), returns null for both the setter name and the finder name (Probably a better way to do it, but breaks old code).
    We've rolled back to Java 1.2 and everything works again. It looks to me like the best way to fix the problem for 1.3 is to write custom BeanInfo classes for each JSP custom tag (Can anybody recommend a good JavaBeans book?). I don't yet know what will happen when you have multiple setter methods with different parameter types??? - something I've always found useful in custom tags.
    You don't get the problem on some JSP engines that don't use the Introspector (apparently JRun just puts the method name in the code and lets it fail at runtime if it doesn't exist, whereas apache and iPlanet check the methods exist at compile time).
    Here's where I got most of the answers from:
    http://groups.google.com/groups?hl=en&safe=off&ic=1&th=9330b85b1867cc7,3&seekm=8rnl24%24ef1%241%40nnrp1.deja.com#p
    http://groups.google.com/groups?hl=en&safe=off&ic=1&th=edd3053ac670ff5b,8&seekm=D8E32A666B62F7BD0076240185256A16.0073785185256A15%40webforums#p
    http://groups.google.com/groups?hl=en&safe=off&ic=1&th=7b5480449150ea26,3&seekm=3B2FA8C3.3F14A9F3%40switzerland.org#p

Maybe you are looking for