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 / January 2006



Tip: Looking for answers? Try searching our database.

setting values

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Craig77 - 30 Jan 2006 06:32 GMT
i have a simple form which i am tring to set the values of a column in my
table, i have tried the code below which works, but this gives my a submit btn
for each record, because i have hundreds of records i need one submit btn to
set all the values

is this possable?

***FORM***
<cfoutput query="Organ">
  <table border="0">
    <form name="form1" method="post" action="TempUpdate.cfm"><tr>
      <td width="276"><input type="Text" size="3" name="OrganID"
value="#Organ.OrganID#">
     <input type="Text" size="3" name="OrganName" value="#Organ.OrganName#">
</td>

      <td width="107"><input type="submit" name="Submit" value="Submit">
       
      </td>
    </tr></form>
  </table>
</cfoutput>

***ACTION***
<cfquery datasource="DPSGuide">
UPDATE Aged_Care_Facility_Details
SET
ACAS_RegionIDNo = #form.OrganID#
WHERE OrganisationName = '#form.OrganName#'
</cfquery>
Ashish_Saxena - 30 Jan 2006 09:43 GMT
Hi
Followinf code may help you to.

<head>
  <SCRIPT language="JavaScript">
     function val()
       {        
               var strSelectedRow = new String();
                var strEnteredValue = new String();
                var setFirstRow = true;
                for(var i=0;i < 15;i++)
                {//for
                 //alert("document.postForm.AA[i].value = "+
document.postForm.AA[i].value )
                  if(document.postForm.AA[i].value != "")
                     {//if AAA
                        if(setFirstRow)
                          {
                           strSelectedRow = document.postForm.hiddenRowCount[i].value;
                            strEnteredValue = document.postForm.AA[i].value;
                           setFirstRow= false;
                          }
                         else
                          {
                           strSelectedRow = strSelectedRow+","+
document.postForm.hiddenRowCount[i].value;
                            strEnteredValue = strEnteredValue+","+ document.postForm.AA[i].value;
                          }
                       
                     }//if AAA
                }//for
                alert("strSelectedRow = "+strSelectedRow);
                alert("strEnteredValue = "+strEnteredValue);
                //document.postForm.action='index.cfm?fuseaction=FinalizeShipmentReport';

                document.postForm.action='try.cfm?strSelectedRowURL='+strSelectedRow+'&strEn
teredValueURL='+strEnteredValue;
                document.postForm.submit();
        }
  </SCRIPT>
</head>  

 <cfparam  name="URL.strSelectedRowURL"  default="nothing">
 <cfparam  name="URL.strEnteredValueURL"  default="nothing">
 
<cfif URL.strSelectedRowURL IS NOT 'nothing'>  
     <cfoutput>
         URL.strSelectedRowURL = #URL.strSelectedRowURL#<br>
          URL.strEnteredValueURL = #URL.strEnteredValueURL#
     </cfoutput>
   
 </cfif>  
<form name="postForm" METHOD="post" >
    <cfloop index="i" from="1" to="15">
           <input type="text" name="AA"> <br>
        <INPUT type="hidden" NAME="hiddenRowCount"
value="<CFOUTPUT>#i#</CFOUTPUT>">    <!--- Passing hidden value along with every
test field --->
    </cfloop>
    <INPUT type="button" NAME="Update" value="Press Me" onClick="val();">   
</form>
Ashish_Saxena - 30 Jan 2006 09:43 GMT
Hi
Followinf code may help you to.

<head>
  <SCRIPT language="JavaScript">
     function val()
       {        
               var strSelectedRow = new String();
                var strEnteredValue = new String();
                var setFirstRow = true;
                for(var i=0;i < 15;i++)
                {//for
                 //alert("document.postForm.AA[i].value = "+
document.postForm.AA[i].value )
                  if(document.postForm.AA[i].value != "")
                     {//if AAA
                        if(setFirstRow)
                          {
                           strSelectedRow = document.postForm.hiddenRowCount[i].value;
                            strEnteredValue = document.postForm.AA[i].value;
                           setFirstRow= false;
                          }
                         else
                          {
                           strSelectedRow = strSelectedRow+","+
document.postForm.hiddenRowCount[i].value;
                            strEnteredValue = strEnteredValue+","+ document.postForm.AA[i].value;
                          }
                       
                     }//if AAA
                }//for
                alert("strSelectedRow = "+strSelectedRow);
                alert("strEnteredValue = "+strEnteredValue);
                //document.postForm.action='index.cfm?fuseaction=FinalizeShipmentReport';

                document.postForm.action='try.cfm?strSelectedRowURL='+strSelectedRow+'&strEn
teredValueURL='+strEnteredValue;
                document.postForm.submit();
        }
  </SCRIPT>
</head>  

 <cfparam  name="URL.strSelectedRowURL"  default="nothing">
 <cfparam  name="URL.strEnteredValueURL"  default="nothing">
 
<cfif URL.strSelectedRowURL IS NOT 'nothing'>  
     <cfoutput>
         URL.strSelectedRowURL = #URL.strSelectedRowURL#<br>
          URL.strEnteredValueURL = #URL.strEnteredValueURL#
     </cfoutput>
   
 </cfif>  
<form name="postForm" METHOD="post" >
    <cfloop index="i" from="1" to="15">
           <input type="text" name="AA"> <br>
        <INPUT type="hidden" NAME="hiddenRowCount"
value="<CFOUTPUT>#i#</CFOUTPUT>">    <!--- Passing hidden value along with every
test field --->
    </cfloop>
    <INPUT type="button" NAME="Update" value="Press Me" onClick="val();">   
</form>
 
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.