Copy link to clipboard
Copied
The problem is when I try to editing one of my values all the drop-down lists return to the first one in the list and not the one they selected originally.
Thats why the user have to chose original value in drop-down lists everytime When they editing. .
this is my code :
<cfset AboneID="">
<cfset Aciklama="">
<cfset musteriTipi="">
<cfif IsDefined("url.id") and IsNumeric(url.id)>
<cfquery name="u" datasource="deneme">
SELECT * from MusteriHareketleri
where MusteriId=<cfqueryparam cfsqltype="cf_sql_integer" value="#url.id#">
</cfquery>
<cfset AboneID = u.AboneID>
<cfelseif IsDefined("url.did") and IsNumeric(url.did)>
<cfquery datasource="deneme">
DELETE MusteriHareketleri WHERE MusteriId=<cfqueryparam cfsqltype="cf_sql_integer" value="#url.did#">
</cfquery>
</cfif>
<form name="add_deneme" method="post">
<table border="3">
<tr>
<td><strong>Abone ID: </strong></td>
<td><input type="text" name="AboneID" id="a" required="yes" value="<cfoutput>#AboneID#</cfoutput>" >
</td>
</tr>
<br>
<tr>
<td><strong>Musteri Hareket Kodu: </strong></td>
<td>
<select name="Aciklama" required="yes" >
<option value="YENI ABONELIK KAYDI">1</option>
<option value="HAT DURUM DEGISIKLIGI">2</option>
<option value="SIM KART DEGISIKLIGI">3</option>
<option value="ODEME TIPI DEGISIKLIGI">4</option>
<option value="ADRES DEGISIKLIGI">5</option>
<option value="IMSI DEGISIKLIGI">6</option>
<option value="TARIFE DEGISIKLIGI">7</option>
<option value="DEVIR (MUSTERI) DEGISIKLIGI">8</option>
<option value="NUMARA DEGISIKLIGI">9</option>
<option value="HAT IPTAL">10</option>
<option value="MUSTERI BILGI DEGISIKLIGI">11</option>
<option value="NUMARA TASIMA">12</option>
<option value="NUMARA DEGISMEDEN NAKIL">13</option>
<option value="NUMARA DEGISTIREREK NAKIL">14</option>
<option value="IP DEGISIKLIGI">15</option>
</select>
</td>
</tr>
<br>
<tr>
<td><strong>Musteri Tipi: </strong></td>
<td>
<select name="musteriTipi" required="yes" >
<option value="G-SAHIS">G-SAHIS</option>
<option value="G-SIRKET">G-SIRKET</option>
<option value="T-SIRKET">T-SIRKET</option>
<option value="T-KAMU">T-KAMU</option>
</select>
</td>
</tr>
</table>
<br><input type="submit" name="Kaydet" value="KAYDET">
<cfif IsDefined("url.id") and IsNumeric(url.id)>
<input type="hidden" name="MusteriId" value="<cfoutput>#url.id#</cfoutput>">
</cfif>
</form>
<cfif IsDefined("form.MusteriId")>
<cfquery datasource="DENEME">
UPDATE MusteriHareketleri
SET
AboneID=<cfqueryparam cfsqltype="cf_sql_integer" value="#form.AboneID#">,
Aciklama=<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.Aciklama#">,
musteriTipi=<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.musteriTipi#">
WHERE MusteriId= <cfqueryparam cfsqltype="cf_sql_integer" value="#form.MusteriId#">
</cfquery>
<cfelseif IsDefined("form.Aciklama")and isdefined("form.musteriTipi")>
<cfquery datasource="DENEME">
INSERT INTO MusteriHareketleri (AboneID,Aciklama,musteriTipi)
values (
<cfqueryparam cfsqltype="cf_sql_integer" value="#form.AboneID#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.Aciklama#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.musteriTipi#">
)
</cfquery>
<cflocation url="http://127.0.0.1:8500/ADD_DENEME.cfm" addtoken="false">
</cfif>
<cfquery name="ADD" datasource="DENEME">
select * from MusteriHareketleri ;
</cfquery>
<cftable query="add" colheaders="True">
<cfcol header="MusteriId" text="#MusteriId#">
<cfcol header="Aciklama" text="#Aciklama#">
<cfcol header="musteriTipi" text="#musteriTipi#">
<cfcol header="AboneID" text="#AboneID#">
<cfcol header="zamani" text="#zamani#">
<cfcol header="Durum" text="<a href='http://127.0.0.1:8500/ADD_DENEME.cfm?id=#add.MusteriId#'>Edit</a>">
<cfcol header="" text="<a href='http://127.0.0.1:8500/ADD_DENEME.cfm?did=#add.MusteriId#'>DELETE</a>">
</cftable>
You can have a variable, but your <option> tags above don't include any variables or "selected" attributes. If your options are in a query or some other loop, you can include your "selected" attribute there. Here's how I like to do it:
<cfloop query="myQuery">
<cfset selected = (myQuery.myColumn eq previouslySelectedValue) ? "selected" : "">
<option value="#myQuery.myColumn#" #selected#>#myQuery.myColumn#</option>
</cfloop>
PS...Dear Adobe, why isn't Coldfusion included in the list of languages in
...Copy link to clipboard
Copied
You don't appear to be setting any of your select options as selected. By default the first option is always selected; if you don't want the default, you must mark a particular option as selected.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
You can have a variable, but your <option> tags above don't include any variables or "selected" attributes. If your options are in a query or some other loop, you can include your "selected" attribute there. Here's how I like to do it:
<cfloop query="myQuery">
<cfset selected = (myQuery.myColumn eq previouslySelectedValue) ? "selected" : "">
<option value="#myQuery.myColumn#" #selected#>#myQuery.myColumn#</option>
</cfloop>
PS...Dear Adobe, why isn't Coldfusion included in the list of languages in the Code editor?
Copy link to clipboard
Copied
For the same reason that CF wasn't originally one of the visible options in the main forum area on this portal: Adobe secretly hates CF and wants to see it disappear.
/s, I guess?
V/r,
^ _ ^
Copy link to clipboard
Copied
No, Adobe doesn't "hate" CF. It IS likely true that nearly all 21,000 of Adobe's employees don't know it exists, and therefore don't have concern for it.
It's true as well that CF doesn't fit with all the other prominent Adobe products.
But it's also true that there are about 70 other Adobe products that don't appear on the front page of the Adobe site, on the first list of any products page, or that front page of the forums area.
And there's an entire team of people behind CF who spend every day creating, updating, and supporting. They don't hate it and certainly don't want to see it disappear. And yet you lump them in with all of Adobe. Please folks, stop.
The constant self-loathing expresssed by some in the CF community is really sad to see. Why can't people just use the tool, help others use it, and stop worrying about all the melodrama?
Indeed, in today's PC culture, why is ok for people to throw shade on Adobe at every opportunity? And for still other folks to directly or indirectly shame those who still happily use, support, and encourage use of CF?
Copy link to clipboard
Copied
What code editor are you referring to?
Copy link to clipboard
Copied
It's the editor that pops up here when you click "</>" to insert a code sample. There's a dropdown to choose a language and CF isn't included. Not that it really mattered, but I would just expect Adobe to include their own...