>    So you're saying that the textbox field value is not being passed
>    and the "Search" button value is?  That makes sense, because

No, I'm saying the textbox will always be submitted, regardless of how the form is submitted. The search button will only be passed if you click it.

> <CFIF IsDefined("Form.Search")>

This is not the name of the textbox.

> I checked for the presence of Form.Search when the Enter key is hit while
> the cursor is in the Keyword Text Input Field and it was not present.

This is not the name of the textbox. I said (twice now), check for the presence of the textbox.

> When the form is submitted by hitting the Enter key, the Search button value is not
> passed.  But the hidden field is passed

As is the textbox, as I said the first time I responded to your post. You do not need to add any hidden fields, simply check for the existence of the textbox.

> So now I've learned something new...don't use the submit button value or
> presence as a trigger, use the value or presence of a hidden field...

And I'm telling you that you don't need to add an unecessary hidden fields, just use the field(s) you already have in the form - eg. the search textbox.

Aaron

----- Original Message -----
From: Rick Faircloth
To: CF-Talk
Sent: Wednesday, July 28, 2004 5:42 PM
Subject: RE: Text Input Field Data not recognized with use of Enter key

Alright, I give...

The code for the form and the text input field of concern:

<Form Name="PropertySearchForm" Action="" Method=POST>

<CFIF IsDefined("Form.Search")>

     <INPUT Name="Keyword" Type="Text"
Value="<CFOUTPUT>#Form.Keyword#</CFOUTPUT>"
       Size="30" MaxLength="30" Class="TextInput01">

<CFELSE>

     <INPUT Name="Keyword" Type="Text" Value="" Size="30" MaxLength="30"
Class="TextInput01">

</CFIF>

</Form>

I checked for the presence of Form.Search when the Enter key is hit while
the cursor
is in the Keyword Text Input Field and it was not present.

Click outside the Keyword Text Input Field and hit the Enter key and
"Form.Search"
is present.

The form is submitting back to the page which it's on, if that
matters...everything works fine
except when the cursor is in the Keyword field when the Enter key is hit.
The cursor can be in the
Keyword field when the "Search" button is clicked and everything works
fine...go figure...

Hmmm....I just check something else, also.  When I select a city for the
search (this is a real estate
application) and put the cursor in the Keyword field and hit the Enter key,
the value for the city is passed
by the form, but the value for Form.Search (The Search Button) is not
present...

(Pause...trying out an idea...) Well, the trick is to have a hidden field in
the form and to check
for its presence instead of checking for the presence of the value of the
Search button.  When the
form is submitted by hitting the Enter key, the Search button value is not
passed.  But the hidden field
is passed and can be used to trigger the search action involving the Keyword
field.  You can see from
the code above that the Keyword field value was not factored in if the
Form.Search field was not defined.

So now I've learned something new...don't use the submit button value or
presence as a trigger,
use the value or presence of a hidden field...

Rick
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to