×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Edit page containing DropDowns

Edit page containing DropDowns

Edit page containing DropDowns

(OP)
Good afternoon,

I have 3 tables in a database called Invoicing. The main table is called MonthlyCharges and contains fields such as MonthlyChargesid, client (which relates to a field ClientID in the 2nd table called ClientTable and contains fields such as ClientID, ClientName, ClientDetails etc), unit (which relates to unitID in the Units table which contains fields such as UnitID, UnitName etc), Amount etc.

When a new record is created, I want the person adding a new record to be able to select from dropdowns for the clients and units, populated by queries for the 2 other tables. When editing, the same dropdowns will appear and selected on the item which was selected when the record was created.

This is an example of the code in the edit page; I don't know how to write the CFIF code which would select in a dropdown the chosen client and then send the relevant clientid to write to the database in the ation page.

<cfoutput query="UpDateclient">
        <cfform action="update_action.cfm" method="Post">
                          <tr>
                <td>ID </td>
                <td><cfinput name="ClientMonthlyCharge_ID" type="hidden" value="#ClientMonthlyCharge_ID#" size="50"></td>
            </tr>
            <tr>
                <td>Contact Name </td>
                <td><cfinput name="ContactName" type="text" value="#ContactName#" size="50"></td>
            </tr>
              <tr>
                <td width="111">Rate</td>
                <td width="457"> <cfinput type="Text" name="Rate" value="#Rate#" size="50"></td>
              </tr>
              <tr>
                <td>Rate Unit</td>
                <td> <cfinput type="Text" name="RateUnit" value="#RateUnit#" size="50"></td>
              </tr>
            <!--<tr>
                <td>Client</td>
                <td> <cfinput type="text" name="Client" value="#Client#" size="50"></td>
              </tr>-->
              
            <tr>
                <td>&nbsp;</td>
                <td><cfinput type = "submit" name="update" class="button" value = "Update"  
                                    onClick="return confirm('Are You Sure You Want To Update This Record?');"></td>
            </tr>
        </cfform>
        </cfoutput>

I hope this makes sense and thank you in advance for your help.

Many thanks.

RE: Edit page containing DropDowns

I think you will need a query to get all the "active" clients. Then you can try the following

CODE

<cfoutput query="UpDateclient">
<form>
...
<tr>
    <td>Client</td>
    <td>
    <select name="client" id="client">
        <option value="">select client</option>
        <cfloop query="getClients">
        <option value="#clientID#"<cfif getClients.clientID eq UpDateclient.clientID>selected="selected"</cfif>>#clientName#</option>
        </cfloop>
    </select>
    </td>
</tr>
...
</form>
</cfoutput>

By the way, I am not a big fan of cfinputs.  

ColdFusion Ninja for hire.

RE: Edit page containing DropDowns

(OP)
Thanks FALCONSEYE for your help.

I have an action page which has been giving me the following error;

Error Executing Database Query.
[Macromedia][SQLServer JDBC Driver]Invalid parameter binding(s).

I have cut down the page to see why it is throwing up the error, until finally all I have left is;


<cfquery datasource="test">
      UPDATE ClientMonthlyChargesTable
        SET ContactName = <cfqueryparam  value="#Form.ContactName#">
       WHERE    ClientMonthlyCharge_id = <cfqueryparam value="#Form.ClientMonthlyCharge_id#">                                  
</cfquery>

Many thanks for your help in advance.

 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close