Using Eval To Set Dynamic Object Names
I've ran into a little trouble with Eval, hoping someone can point it out to me. This code works :
var_ktml = "textarea2"
Set ktml_textarea2 = new ktml4
Eval("ktml_" & var_ktml).Init var_ktml
This code doesn't :
var_ktml = "textarea2"
Set Eval("ktml_" & var_ktml) = new ktml4
Eval("ktml_" & var_ktml).Init var_ktml
Can anyone point out the error of my ways ?
View Replies
ADVERTISEMENT
I'm having a brain fart at the moment. Can someone tell me how to dynamically create variable names based on a loop counter?
for i = 1 to Num_Cart_Items
Item_Name & i = Request.Form("item_name" & i)
Item_Number & i = Request.Form("item_number" & i)
next
Desired result:
Item_Name1 = Test Product
Item_Number1 = 1234
Item_Name2 = Test Product 2
Item_Number2 = 2345
The problem is with the Item_Name & i..I used to know how to do this, but I can't remember or find any code that I did this with.
View Replies
View Related
Is it valid to get information from a request.form assign that to a value then use that value to get other content on the requested page.
I return a large rs with multiple feild names. I can't use a static feild def because they would overwrite each other on the loop, SO i create dynamic field names then pass the id back to the next page via javascript. I then use that id to add to the feild name to make sure I get the right feild.
Id = Request.Form("Id")
SQL STUFF
CheckedID=Request.Form("Name_"&Id)
View Replies
View Related
Is there a way (and can you give me a very brief example or point me to one)
to go through all the form objects sent by a PUT to determine what the form
object names were and the values sent?
I need to do this with VBScript on a "classic" ASP application.
Request.Form doesn't seem to do it. While I can tell how many objects were
sent (Request.Form.Count) and what the value of each object is
(Request.Form(I).Item or simply Request.Form(I)) to some degree, I can't
seem to nail down the object name.
Also, I noticed that a <button> field with an embedded <img> returns the
image when queried by Request.Form(I).Item.
View Replies
View Related
I have a little code to add multiple items to a shopping cart based
page. This code works perfect, but it adds all of the info to the
same input fields every time it loops. I need it to change the input
names each time it loops. Here is the code:
View Replies
View Related
I have the following code (part of a larger asp page) to create the user input form for creating user accounts in AD.
What would be nice is to have the radio control (in red) to be created as the result of interrogating AD to retrieve a list of containers (we have a container per office location) so that only relevant controls are available, and if a new office is opened or they shut one down, the form can stay the same. Is there a way to do this? Code:
View Replies
View Related
The eval function in JScript doesn't work according to
spec. Specifically, the function C() on page 73 of the
ECMA-262 spec doesn't return the function object
correctly under IIS 5. Binding the anonymous function to
a variable name and then evaluating that works as a
workaround, e.g.
function C() {
return eval("var x = (function (x) {return x*;}); x");
}
works. However, it should be possible to simply evaluate
a function without binding it to a name using the eval
function, especially since the spec has an explicit
example of this.
View Replies
View Related
According to MSDN: "new variables or types defined in the
eval statement are not visible to the enclosing program."
However, in some cases under IIS 5, this is not the case.
Try the following program:
eval("var z = 12; 5;");
Response.Write(z);
According to the documentation this should be an error;
however, it prints "12".
View Replies
View Related
Is there an equivalent function in ASP which does the same as PHP's eval function?
View Replies
View Related
I basically want to check a multiple amount of form fields to see if these are empty, and if so, set them to "none", but it just doesn't seem to work. and I have tried so many different variants without any luck, mixing the execute command and as below with the eval command.
strChecks = "frm_tel|frm_email|frm_web|frm_infoes|frm_infode"
arrChecks = split(strChecks,"|")
for i = 0 to UBound(arrChecks)
if eval(arrChecks(i)) = "" then
eval(arrChecks(i)) = "none"
end if
next
View Replies
View Related
I have some code that checks security permissions in a DB, and before my conditional statement that checks these permissions, I am writing out both values to see what the statement looks likebefore it is evaluated.
The problem is, it seems to disregard the condition and always returns True, even if the condition should be false...any ideas? I also did some testing to assure that the length of the two values I am comparing is 1, just in case they were possibly holding spaces, and I verified they are numeric as well. I am just stumped here...
Let me also preface this code snippet by saying, I am using this asp script to generate javascript menu choices...and I did include some commented debug statements so I can see what the javascript rendered.. Code:
View Replies
View Related
I've been doing some reading up on ASP.NET and have come across something that really scares me. One of ASP.NET's "big new things" are ASP.NET Controls. These seem to be shortcuts for developers so, for example, you can place a Validator object on the page and specify a few parameters and ASP.NET will write all of the html/javascript for you. The reason this scares me is it seems that Microsoft is taking ASP.NET the route of Frontpage, which liked to insert code that was not very cross-browser complient.
View Replies
View Related
I code that creates a calendar for each month and then it displays events from that month that are stored in a db. I need to loop through my recordset and display all the events, but I can't quite figure out how to do it. I am thinking I need to do an array. But I am not really sure.... any ideas. Here is where you can view the calendar. Code:
View Replies
View Related
Does anyone have some sample code on how to get all tables names in a MS Access database?
View Replies
View Related
I need the names of some either ASP or PHP programs that will work like a video rental store. I know there are some out there, but i cant seem to remember the name of them. I would prefer something that is free.
View Replies
View Related
Does any one know how many characters possible in a variable name in ASP?
Is it only 15 characters long or could it be more?
i.e. could the variable name be ThisIsTheFirstName
I do not name my variables like this but I would like to know the max length possible.
View Replies
View Related
I have a web application which saves files to a server and emails the file as an attachment. I generate a unique name for each file by concatenating a unique numeric string so the file name is unique and cannot be accidentally be overwritten. I also store the original name of the file. Is there any way to rename the attachment when I send it so it doesn't have the unique name but rather the orignal one.
View Replies
View Related
im reading from multiple databases, and one restraint is that i must know the amount of columns and the names of the columns before i can display info from the database.my question: can i somehow GRAB or READ this information from each database and then just adapt my Display accordingly
View Replies
View Related
Is it possible with ASP to use arrays with names (e.g user("username") = "ble") instead of numbers (e.g user(1) = "ble")?(I do know of the dictionary object, but is it wise to use that 7 times or more a page?
View Replies
View Related
ive got a small problem, i dont know if this is possible but its bound to be. What im trying to do is request a cookie which contains a database table name and put that inside an sql query...sort of like this
id = request.cookies("tablename")
mySQL = "SELECT * FROM &'id'&"
i know that doesnt work, ive tried every other combination .
View Replies
View Related
I am planning my next move on my current website and am looking at doing the following. I am adding a feature where as a database can be viewed on the web page as this has been requested for me to do.
I am pretty sure i can do this without a problem except for getting all of the table names. Is there an SQLQ command where you can say
SELECT (ALL TABLE NAMES) FROM DATABASE.
Antoher way to look at it is to have a seperate table in each of the databases to hold all of the table names.
View Replies
View Related
a script that will automatically pull the names and custom preview icons of image files from a folder and display them on a page? is this possible? i need to use this script on a win 2000 server.
View Replies
View Related
I have two temporary variables that are equal to folder paths. The first temporary variable could equal one folder name or multiple folder names depending upon an if statement so "" & fldr1 & "" & folder.name & "" will not work.
Is it possible to combine both into a third temporary variable? Example:
TempPath1 = "" & fldr1 & ""
TempPath2 = "" & folder.name & ""
FullTempPath = TempPath1 & TempPath2
FullPath = fso.GetFolder(Server.MapPath(FullTempPath))
View Replies
View Related
We have a script the will grab names from a form and display them on the next page but will only get a max of 60 to 80 names depending on the total number of characters of each name.
Can anyone guide us on how to create a script, where if a user copies and pastes 5000 names or email addresses into a form and clicks submit, we can then grab each name and display individually on the next page?
View Replies
View Related
Does anyone know of a script or library that provides a way to match first names with common nicknames or shortened forms?
I'm developing criteria to determine whether two database entries represent the same person, and I definitely want people named 'Bill' and 'William' to score as having the same first name, for example.
View Replies
View Related
in my drop down dont want to show country names like United States and Canada but its still showing Code:
nusa="United States"
ncanada="Canada"
Set rs = Server.CreateObject("adodb.RecordSet")
strcountry="SELECT * from tblCountries where CountryName Not In ('"& nusa & "," & ncanada & "')"
rs.Open strcountry,cardconn, 2, 2
is the syntax ok
View Replies
View Related
Is it possible to get a db's column names not the data inside the columns just the columns names.
View Replies
View Related
i want to make a drop down menu with the names of the tables in the mdb. how do i get this right? do i use a sql statement? i cannot find a sql statement with the command for this.
View Replies
View Related
I 'd like to print out all posted parameter names and values. I'm able to print all the posted request values, but not the parameter names.
View Replies
View Related
I am new to ASP and I cannot figure out how to pass variable content in ASP. How to pass the variable sClientNo in the following redirect.
Response.Redirect("AccessDenied.asp?ClientNo=sClientNo")
View Replies
View Related
I have a db auto uploaded to me everyday. I am displaying information from the db, but some of the columns contain spaces. When I use a space in a select statement it obviously does not work. Is there some special syntax I need to allow for a column name that contains a space?
View Replies
View Related
I have built input fields inside a while not.eof loop
and the name is built from using <%="name"&i%> and the value is a product_id
from the database.the i is then incremented in the loop, resulting in <input name="name1, <input name="name2
and so on. this works no probs, however i haven't got a clue on how to collect this dynaimcally named
input field when it arrives at the form action address page.
I was thinking some kind of for loop but am not sure, and again am not sure where to put the <%="name"&i%> bit
to count or grab the input fields info.
i.e newname= REquest.Form(<%="name"&i%>)
View Replies
View Related
I have a "csv file" as a database.
The 1st row contains the field names:
Orion.Accounts.AccountName,Orion.Accounts.Address1
the code I use normally works:
<%=rs("Orion.Accounts.AccountName")%>
Although in this case is doesn't because the fieldnames contain full stops.
how to modify this line:
<%=rs("Orion.Accounts.AccountName")%>
View Replies
View Related