Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Bind checkboxes in Flash form

LEGEND ,
Nov 14, 2008 Nov 14, 2008
I have a 2-part form, grid and edit pane. The grid is populated from a query
and shows only enough of the record to make it recognizable. The user
selects a record, which then populates the edit pane. Everything works fine
except the binds to checkboxes and a select dropdown.

I use the following for my text binds... <cfinput type="checkbox"
name="ConnASU2" value="ConnASU2" label="Connections to ASU"
bind="{buildingList.selectedItem.ConnASU}" /> Pretty standard stuff. However
getting the checkboxes and select to show the proper selections has eluded
me.

The form can be seen at
http://www.west.asu.edu/dpc/commbldgrpt/editdel2.cfm. All checkboxes are
'true' in the DB. 'Month' should be the dropdown.

Assistance appreciated.

Thanks.

John


1.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 14, 2008 Nov 14, 2008
Could you show that piece of code. I have some suggestions, but they'll be specific to your particular case.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 25, 2008 Nov 25, 2008
I set everything back to the 'standard' text-type bind, since I couldn't
figure it out...

<cfinput type="checkbox" name="ConnRes2" value="ConnRes2" label="Connect
With Your Residents" bind="{buildingList.selectedItem.ConnRes}" />

Obviously that bind won't cut it for a checkbox. The values for the
checkboxes are all pulled in via the query, but are not displayed in the
grid because of space constraints.I suspect I have to add them to the grid
with a display="no", but I'm still stuck on the bind.

Thanks.

"BKBK" <webforumsuser@macromedia.com> wrote in message
news:gfls0r$ai3$1@forums.macromedia.com...
> Could you show that piece of code. I have some suggestions, but they'll be
> specific to your particular case.
>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 25, 2008 Nov 25, 2008
Here then:

<cfset dates = "2/21/2005,3/4/2006,4/14/2007,5/23/2007,11/25/2008">
<!--- NB: Avoid the usual space after comma. Otherwise cannot cast string list-element to boolean.
Actionscript doesn't have trim function to help you here --->
<cfset choices = "true,false,true,true,false">
<cfform name="myDatePicker" format="flash">
<cfgrid name="dateChoice" height = "120" onchange="setMonthAndChoice();">
<cfgridcolumn name="dt" header="Date">
<cfgridcolumn name="ch" header="Choice">

<cfloop index="i" from="1" to="#ListLen(dates)#">
<cfgridrow data ="#ListGetAt(dates, i)#,#ListGetAt(choices, i)#">
</cfloop>
</cfgrid><br /><br />
<cfformitem type="script">
function setMonthAndChoice(){
var isTicked = true;
// equivalent to a cast from string to boolean
if(dateChoice.selectedItem.ch != 'true')isTicked=false;

// check or uncheck checkbox
choice.selected = isTicked;
// get month number out of date
mnth.setSelectedIndex(parseInt(dateChoice.selectedItem.dt.split('/')[0])-1);
}
</cfformitem>
<cfinput name="date" type="text" label="Date" bind="{dateChoice.selectedItem.dt}" />
<cfinput name="choice" type="checkbox" label="Yes or no?"/>
<cfselect name="mnth" label="Month">
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</cfselect>
</cfform>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 04, 2008 Dec 04, 2008
LATEST
Thank you. Will give it a try.

"BKBK" <webforumsuser@macromedia.com> wrote in message
news:ggiudg$ntl$1@forums.macromedia.com...
> Here then:
>
> <cfset dates = "2/21/2005,3/4/2006,4/14/2007,5/23/2007,11/25/2008">
> <!--- NB: Avoid the usual space after comma. Otherwise cannot cast string
> list-element to boolean.
> Actionscript doesn't have trim function to help you here --->
> <cfset choices = "true,false,true,true,false">
> <cfform name="myDatePicker" format="flash">
> <cfgrid name="dateChoice" height = "120" onchange="setMonthAndChoice();">
> <cfgridcolumn name="dt" header="Date">
> <cfgridcolumn name="ch" header="Choice">
>
> <cfloop index="i" from="1" to="#ListLen(dates)#">
> <cfgridrow data ="#ListGetAt(dates, i)#,#ListGetAt(choices, i)#">
> </cfloop>
> </cfgrid><br /><br />
> <cfformitem type="script">
> function setMonthAndChoice(){
> var isTicked = true;
> // equivalent to a cast from string to boolean
> if(dateChoice.selectedItem.ch != 'true')isTicked=false;
>
> // check or uncheck checkbox
> choice.selected = isTicked;
> // get month number out of date
>
> mnth.setSelectedIndex(parseInt(dateChoice.selectedItem.dt.split('/')[0])-1);
> }
> </cfformitem>
> <cfinput name="date" type="text" label="Date"
> bind="{dateChoice.selectedItem.dt}" />
> <cfinput name="choice" type="checkbox" label="Yes or no?"/>
> <cfselect name="mnth" label="Month">
> <option value="1">January</option>
> <option value="2">February</option>
> <option value="3">March</option>
> <option value="4">April</option>
> <option value="5">May</option>
> <option value="6">June</option>
> <option value="7">July</option>
> <option value="8">August</option>
> <option value="9">September</option>
> <option value="10">October</option>
> <option value="11">November</option>
> <option value="12">December</option>
> </cfselect>
> </cfform>
>
>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources