#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Location
    Norwich
    Posts
    53
    Rep Power
    11

    simple if else question


    I am new to coldfusion. I am having problems with the syntax. This should be easy.


    With this code:

    <td><select name="RegionTown">
    <option value="0">Search by town or region</option>

    <option value="1">Search by region</option>

    <option value="2">Search by town</option>

    </select></td>

    i want to do this if else statement:

    <cfif name="RegionTown" option value="1">

    ... Do something here

    <cifelse>

    ... Do something different here

    </cif>


    Hope you can help.

    Cheers

    Peter
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    Dubai, UAE
    Posts
    449
    Rep Power
    15
    <cfif #form.RegionTown# EQ 1>

    ...............

    <cfelse>

    ...............

    </cfif>
  4. #3
  5. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,263
    Rep Power
    968
    You don't need the pound signs:

    <cfif form.regionTown eq 1>
    ...


    However, I suspect that what this person is trying to do must be done with Javascript. It looks like they are trying to make CF respond to a change in a form field within the same page, which CF can't do (nor any other server-side application server). If you post this form to the server, the next page can respond based on the selection that was submitted. But without a page refresh, you have no choice but to write Javascript event handlers to do this.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Location
    Norwich
    Posts
    53
    Rep Power
    11

    thanks


    Thanks for your help. a good forum

IMN logo majestic logo threadwatch logo seochat tools logo