Is it possible to display a text box next to a cfselect upon selection in the cfselect.

If someone selects an option from the dropdown I need a date type field to be display. Is this possible perhaps with coldfuision and ajax?

Recommended Answers

All 7 Replies

What options are in the select?

Fully Successful
Exceptional
Needs Improvement

What I need is that when some select Needs Improvement a text box will appear when a date needs to be entered

I've create a simple jsfiddle.

BTW I'm from a ColdFusion background, but I never used any cfform statements.

Input text not showing when choosing needs improvement. How come you dont use cfform statements?

It works I added the jquery links and

<script>
    $(document).ready(function(){
       $("#grade").on("change",function(){
        if($(this).val()==3) {
            $("#datefield").removeClass("hidden");
        } else {
            $("#datefield").val("").addClass("hidden");
        }
    });
    });
</script>

I also added the document ready function. The only thing is that I cannot make the field a datefield type is not adding the calendar next to the text box

I change input to cfinput and the calendar works

Hi,

The jsfiddle, as you have found, adds the onready handler. The reason I never use the cfform statements is that they seemed to require the same amount of work as simply adding the raw HTML equivalents. Sometimes, they require more work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.