• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Element Undifined in form error.

New Here ,
Jun 29, 2007 Jun 29, 2007

Copy link to clipboard

Copied

Hi,

I have the following code:
There will be as many hidden fields as the number of rows retrieved by the query "getCities". Each is distinguished with the value of level_detail_uid for each loop.

city.cfm
----------------

<html>
<head>
<title>Update </title>
<script language="JavaScript">
function delete_city(level_detail_uid,city_id ,cnam)
{
if ( confirm("Are you sure to delete the pricing-information for " + city_id + " ?") )
{
window.location = 'city_pricing_display.cfm?delete_level_detail_uid=' + level_detail_uid +
'&delete_city_name=' + city_id + '&del_cnam=' + cnam;
}

}

<cfif isDefined("delete_level_detail_uid") and delete_level_detail_uid is NOT "">
<cfoutput> #del_cnam#</cfoutput>
<cftransaction>
</cfquery>
</cfif>
</cftransaction>
</cfif>
<form method="POST" name="city_details" action="city_update_pop.cfm">

<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td>
<cfquery name="getCities" datasource="#application.alcdatasource#">
SELECT city_name, dtl.level_detail_uid,
FROM alc_pricing_level_details dtl, alc_city c, alc_detail_provider prvdr
WHERE level_desc_uid = #level_desc_uid#
AND dtl.level_detail = c.city_id(+)
AND prvdr.level_detail_uid = dtl.level_detail_uid
ORDER BY upper(city_name)
</cfquery>
<cfloop query="getCities">
<cfoutput>
<input type="hidden" name="cityname_#level_detail_uid#" value="#getCities_city_name#">
</cfoutput>
<td>
<a href="JavaScript:delete_city('#level_detail_uid#','#city_id#','#form.cityname_#level_detail_uid##')" class="PageInnerNavigationHeadingSmall">Delete City</a>
</td>
</table>
</body>
</form>
</html>


------------------------------------------------------

Suppose the level_detail_uid is 12345.
After executing this it says
"element cityname_ is undefined in form

Please kindly help.....

Thanking in advance....
Regards,
Aswathy.

TOPICS
Advanced techniques

Views

329

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 29, 2007 Jun 29, 2007

Copy link to clipboard

Copied

Post the actual error message and the lines of code it refers to.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 29, 2007 Jun 29, 2007

Copy link to clipboard

Copied

I think it must be this line

<a href="JavaScript:delete_city('#level_detail_uid#','#city_id#', '#form.cityname_#level_detail_uid##')" class="PageInnerNavigationHeadingSmall">Delete City</a>

It might have to be #evaluate("form.cityname_" & level_detail_uid)#

although i can see a number of problems in this code.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jun 29, 2007 Jun 29, 2007

Copy link to clipboard

Copied

LATEST
I agree with cf_matt. There are several problems with the code. The field form.cityname_#level_detail_uid# won't exist when the form is first loaded. So you can't use it in your link unless you define a default value first

<a href="JavaScript:delete_city('#level_detail_uid#','#city_id#','#form.cityname_#level_detail_uid##')" >...</a>

Also, the syntax to retreive the value is wrong. Assuming the variable is defined, try using array notation

#form["cityname_#level_detail_uid#"]#

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation