Skip to main content
Participating Frequently
August 5, 2013
Question

How Can I Get the current value of a binded field for use in a conditional statement?

  • August 5, 2013
  • 1 reply
  • 398 views

Hey guys, I have a CFGRID that's bound to some form fields:

<tr>

<td align="right"><span class="srch_title">First Name 1</span>:</td>

<td align="left"><cfinput name="Data_FName1" type="text" class="inputs_nomargin" bind="{SearchResultsGrid.fname1}"></td>

<td align="right"><span class="srch_title">Last/Bus Name 1</span>:</td>

<td align="left"><cfinput name="Data_LNameBus1" type="text" class="inputs_nomargin" bind="{SearchResultsGrid.lname_busname1}"></td>

<td align="right"><span class="srch_title">DOB 1</span>:</td>

<td align="left"><cfinput name="Data_DOB1" type="text" class="inputs_med_nomargin" bind="{SearchResultsGrid.dob1}"></td>

<td align="right"><span class="srch_title">DL Number 1</span>:</td>

<td><cfinput name="Data_DLNum1" type="text" class="inputs_nomargin" bind="{SearchResultsGrid.dlnum1}"></td>

</tr>

When, clicking on the CFGRID rows, the data in the form fields changes, as expected.

However, I'd like to make some other stuff happen conditionally based on current values of one or more of the form fields.

How can access, for example, the current contents of {SearchResultsGrid.fname1} in a CFIF statement?

Thanks in advance for any help you can give me

T

This topic has been closed for replies.

1 reply

Petro_O__Bochan
Inspiring
August 6, 2013

Hello Tim, would barely fit in this situation since this code resides on the client’s interaction side of things. I’d recommend using JavaScript for this matter, e.g. var Data_FName1 = document.getElementById(‘Data_FName1’).value;. If you still opt for using CFML, then you’d go for proxying your JavaScript code to a CFC.