Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
EdmondsM #1
Bind a textfield with a checkbox
Hi all, is it possible to bind a textfield with a checkbox. What I am trying
to do is, if the checkbox is selected todays date will display in the textbox
next to it. If the checkbox is cleared the date is deleted.
Thanks in advance for your help.
EdmondsM Guest
-
Bind Attribute in CheckBox -->Help
Hello Everyone, I attented a great presentation yesterday by Macromedia Canada. I need a little help regarding the BIND attribute. I am doing... -
bind to a checkbox
I have a tabbed flash form. the final tab is a summary page of the previous two tabbed pages. The second page lists 10 check boxes. If the... -
Howto bind CheckBox to the datagrid/ Then update the database field when the checkbox is clicked.
I am trying to update the database field when the checkbox is clicked. I am trying to modified the following solution but.. got stuck on the... -
How to bind checkbox to one of the values of a datagrid
Hello All, I hope someone can enlighten me, all of the examples and posts Ihave read and sifted through doesn't pertain to what i wouldlike to do... -
how to bind data to checkbox in datagrid
hi i have a datagrid and one colume is a bool if i use a normal asp:BoundColumn is shows as true or false and i want it to show as a checkbox but... -
Velvett Fog #2
Re: Bind a textfield with a checkbox
You'd do this with Javascript.
Velvett Fog Guest
-
Mountain Lover #3
Re: Bind a textfield with a checkbox
<form action="">
<input type="checkbox" name="chktest" value="1" onClick="if
(this.checked){nxtdt = new Date() ;nxtdtstrng = (nxtdt.getMonth()+1) +
'/' + nxtdt.getDate() + '/' + nxtdt.getFullYear()
;this.form.testdt.value=nxtdtstrng}else{this.form. testdt.value=this.form.testdt.defaultValue}"><inpu t
type="text" name="testdt">
</form>
HTH
--
Tim Carley
[url]www.recfusion.com[/url]
[email]info@NOSPAMINGrecfusion.com[/email]
Mountain Lover Guest
-
EdmondsM #4
Re: Bind a textfield with a checkbox
Hey Tim, this is beautiful. The only draw back is that it give me a the
following message.
Illegal usage of actionscript.
The following actionscript commands are not allowed: "import, new, delete,
createChild, loadmovie, duplicateMovieClip, AttachMovie, registerclass,
createTextField, __proto__".
I think this is to to the following line of code {nxtdt = new Date() . Is
there anyway around this?? Where can I get more information on Actionscripts.
Thanks again.
EdmondsM Guest
-
Mountain Lover #5
Re: Bind a textfield with a checkbox
You didn't say you were using Flash forms. Can't help you there. The
Javascript given works in all html forms.
--
Tim Carley
[url]www.recfusion.com[/url]
[email]info@NOSPAMINGrecfusion.com[/email]
Mountain Lover Guest
-
Typheous #6
Re: Bind a textfield with a checkbox
You might want to look at using the calendar cfinput object.
Or
You could in theory use something like this... It isn't perfect, but I think
it does what you want.
<cfinput type="checkbox" id="senior" name="checky" value="1" label="Checky
Box" />
<cfinput type="text" name="textBoxName" bind="{(checky.selected == undefined)?
'': textBoxName.enabled}" />
Typheous Guest
-
mkane1 #7
Re: Bind a textfield with a checkbox
I don't know about flash forms, maybe you can't use this kind of javascript
with them. But if the problem really is with using "new", then you could try
this: at page load, set a hidden input's value as today's date in the format
you want (I called it dtholder below). Then modify the javascript that Mountain
Lover gave, as below:
<input type="hidden" name="dtholder" value="#DateFormat(Now(), 'mm/dd/yyyy')#">
<input type="checkbox" name="chktest" value="1" onClick="if
(this.checked){this.form.testdt.value=this.form.dt holder.value}else{this.form.te
stdt.value=this.form.testdt.defaultValue}">
<input type="text" name="testdt">
mkane1 Guest
-
The ScareCrow #8
Re: Bind a textfield with a checkbox
Not sure if this will work as I'm away from my dev environment and can't test,
but
<cfoutput>
<cfinput type="checkbox" name="myChk" onchange="{(myChk.selected) ? myTxt.text
= '#DateFormat(Now(), ""mm/dd/yyyy"")#' : ''}">
</cfoutput>
<cfinput type="text" name="myTxt">
I will test this when I can.
Ken
The ScareCrow Guest
-
EdmondsM #9
Re: Bind a textfield with a checkbox
Hi The ScareCrow and mkane1, thanks for your help. ScareCrow, you code did not
porduce the results that I was after. MKane, you code did but it still will
not work in <cfform format=flash>. May this is not possible to do within a
flash page?? It works fine in HTML and XML however.
EdmondsM Guest
-
The ScareCrow #10
Re: Bind a textfield with a checkbox
Attached is a working example
Ken
<cfform action="" method="POST" name="form1" format="Flash" timeout="300"
preservedata="Yes">
<cfinput type="Checkbox" name="myChk" visible="Yes" enabled="Yes">
<cfoutput>
<cfinput type="Text"
name="myTxt"
bind="{(myChk.selected) ? myTxt.text='#DateFormat(Now(),
'mm/dd/yyyy')#' : ''}"
required="No"
visible="Yes"
enabled="Yes">
</cfoutput>
</cfform>
The ScareCrow Guest
-
EdmondsM #11
Re: Bind a textfield with a checkbox
Thanks The ScareCrow, this worked beautiful
EdmondsM Guest



Reply With Quote

