Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Tcal to update two fields at same time
Old 07-12-2010, 03:54 PM Tcal to update two fields at same time
Junior Talker

Posts: 2
Trades: 0
In doing some research I came accross some help Jeremy Miller had given with the tcal script and would like to see if he or others could help me with what seems to be a simple issue, but I can't find any documentation to help.

I have a simple form for the local photographic society that writes to MySql. It has two fields a start date and end date for events. If when displaying the event to the public both dates are the same it only displays the one date if not the same then it displays both dates.

The input on the back end to enter the dates looks like this:
Quote:
<tr>
<td class="title-background">Workshop Date</td>

<td class="table-background">Start date:</td>

<td class="table-background"><input type="text" name="workshop_date_start" maxlength="20" value="{workshop_date_start}" size="20">

<script language="JavaScript">new tcal ({
// form name
'formname': 'EditWorkshop',
// input name
'controlname': 'workshop_date_start'
});
</script>
</td>

<td class="table-background">End date:</td>

<td class="table-background"><input type="text" name="workshop_date_end" maxlength="20" value="{workshop_date_end}" size="20">

<script language="JavaScript">new tcal ({
// form name
'formname': 'EditWorkshop',
// input name
'controlname': 'workshop_date_end'
});
</script>
</td>

</tr>
What I want to be able to do is one of two options:

Option a) When field workshop_date_start is updated by tcal it sets workshop_date_end to the same value at the same time. Thus when editing the end date and opening the field in tcal it will show on the mini calendar the date the event is starting for quicker refence in pickig a closing date, or the user would not have to touch the second field at all if it is a one day event since both field would match.

or

Option b) Not using tcal at all and anytime the workshop_date_start field is updated (even if typed in without using the tcal script) it looks to see if workshop_date_end is greater and if not sets it equal to workshop_date_start in real time. Something along the line of using onfocusout for the date_start field to run a script and check if date_end is greater and if not then seting date_end to the same value as date_sart in the form???

Any suggestions?
jbphoto is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-12-2010, 04:18 PM Re: Tcal to update two fields at same time
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
javascript cannot read from or write to the database
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-12-2010, 05:09 PM Re: Tcal to update two fields at same time
Junior Talker

Posts: 2
Trades: 0
The PHP is writing to the database, I need the javascript to cordinate the frields in the form at input so when one is updated to be sure the next is either the same or greater.
jbphoto is offline
Reply With Quote
View Public Profile
 
Old 07-12-2010, 05:16 PM Re: Tcal to update two fields at same time
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
why not simply use the same form value serverside?
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Tcal to update two fields at same time
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.44607 seconds with 12 queries