Copy link to clipboard
Copied
Hi i am new to coldfusion i had a form and in form we have two date fields like date1------------ to date2---------------- and i need to make the second date field default to 7 calendar days from the first date field that was entered.The new date field needs to be non changale
any help regarding this
thanks.
Copy link to clipboard
Copied
Is it necessary for the user to see the date that is 7 days in the future? If that second date is being stored, maybe you can just calculate it on submission?
If the dates can be flexible, here's a neat jquery option to ensure the end date is not before the start date.
http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/datePickerStartEnd.html
Copy link to clipboard
Copied
yes the user has to see the future date and also user is not allowed to change that date that means we have to disable the second date field when user enters date in first field.
Copy link to clipboard
Copied
Actually it sounds like you want it to always be disabled, which the disable parameter or form controls handles fairly well.
Then you would just use JavaScript date functions to calcualte the 7 day date when the first field is completed and dislplay it in the second field.
Copy link to clipboard
Copied
thanks lan ,any help regarding this i am new to coldfuison and these stuff thanks
Copy link to clipboard
Copied
The first major point is that this is a JavaScript solution that only applies to ColdFusion because it will deliver it to the client along with whatever HTML your page will contain.
JavaScript date object
http://www.w3schools.com/jS/js_obj_date.asp
http://www.w3schools.com/jsref/jsref_obj_date.asp
Input Control
http://www.w3schools.com/tags/tag_input.asp
and its disable property.
http://www.w3schools.com/tags/att_input_disabled.asp
Copy link to clipboard
Copied
i made my text box disabled but i have no idea how to do when a date is selected in first text field then how to populate 7 future days date in second text field any help with this idea.............
Copy link to clipboard
Copied
Kirannaga, there is no need for us to re-invent the wheel. You will find the answer in the thread "Advance date 90 days when date change in Form".
Copy link to clipboard
Copied
Thanks BKBK for ur help but i had problem with this
because i had a componet that is used to select date ie datepicker so when i try to do this i am getting
error , below is my code , would u please help me
<cfform name="dateForm" id="dateForm">
<table>
<td width="440">
<cfinput type="text"
name="avDateFrom"
message="Job Available Date missing - please reenter in the mm/dd/yyyy format."
validate="date"
required="Yes"
size="10" > <cf_calendar datefield="avDateFrom">
<span id="label"> through </span>
<cfinput type="Text"
name="avDateTo"
message="Position Available date is missing, please reenter in the mm/dd/yyyy format. "
validate="date"
size="10" bind="javascript:addDays({dateForm:avDateFrom})" ><img align="absbottom" src="/media/701/calendar.gif" alt="date"/>
</td>
</table>
</cfform>
Copy link to clipboard
Copied
i am getting error
Which?
Copy link to clipboard
Copied
this is the error
Bind failed, element not found: avDateFrom [Enable debugging by adding 'cfdebug' to your URL parameters to see more information]
Copy link to clipboard
Copied
I see that you're also passing the value avDateFrom to the custom tag. Is there more than one field named avDateFrom? What happens when you temporarily comment out the custom tag?
Copy link to clipboard
Copied
there are no more fieldname with avDateFrom,but when i commented the customtag i am not able to select date , i need to select date from using this custom tag only. because we have all the forms with same custom tag that is used for date selections.
Copy link to clipboard
Copied
any help regarding this issue ?
Copy link to clipboard
Copied
What do you want to achieve? In particular, what do the form fields stand for, and what does the custom tag do?
Copy link to clipboard
Copied
the form field is for just puttind date and the custom tag will will give thedate picker that is populated so that we will select the date from that.
Copy link to clipboard
Copied
You could just make the form field avDateFrom and avDateTo to be of type datefield, instead of text