Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Advanced Techniques / June 2007



Tip: Looking for answers? Try searching our database.

Element Undifined in form error.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
baskark - 29 Jun 2007 12:32 GMT
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_#l
evel_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.
jdeline - 29 Jun 2007 16:14 GMT
Post the actual error message and the lines of code it refers to.
cf_matt - 29 Jun 2007 16:30 GMT
I think it must be this line

<a
href="JavaScript:delete_city('#level_detail_uid#','#city_id#',[b]'#form.cityname
_#level_detail_uid##')"[/b] 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.
cf_dev2 - 29 Jun 2007 19:00 GMT
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_#l
evel_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#"]#
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.