Dates put into form when clicked on in the calendar...

Help with installation and general calendar setttings

Dates put into form when clicked on in the calendar...

Postby Eddie » Mon Jul 05, 2010 4:14 pm

Hi,

I have a website which uses this calendar and an enquiries form. When I click on a date on the calendar I need the date to be automatically input into the form.

The form is not a standard form it is a Master Feedback form(prevents spamming) If you are unaware of this form, it is slightly different(uses the cgi-bin) so check out the website for it if you need to. http://www.willmaster.com/software/feedback/index.php

Can anybody help?
Eddie
 
Posts: 3
Joined: Mon Jul 05, 2010 11:16 am

Re: Dates put into form when clicked on in the calendar...

Postby chris » Mon Jul 05, 2010 5:27 pm

Hi,
I know that you say that it is not a standard from, but does that mean that it is not compatible with JavaScaript?
Have you checked this post which explains how to update the code for use with a "normal" form?

Chris
User avatar
chris
Site Admin
 
Posts: 1089
Joined: Mon Dec 17, 2007 7:42 pm
Location: Málaga, Spain

Re: Dates put into form when clicked on in the calendar...

Postby Eddie » Tue Jul 06, 2010 11:14 am

chris wrote:Hi,
I know that you say that it is not a standard from, but does that mean that it is not compatible with JavaScaript?
Have you checked this post which explains how to update the code for use with a "normal" form?

Chris


Yes, it does work with JavaScript and yes I have checked that post and followed it which didn't work for me.
Eddie
 
Posts: 3
Joined: Mon Jul 05, 2010 11:16 am

Re: Dates put into form when clicked on in the calendar...

Postby chris » Tue Jul 06, 2010 11:22 am

Yes, it does work with JavaScript and yes I have checked that post and followed it which didn't work for me.

hmm, doesn't seem to make much sense.
That code is fine in "normal" circumstances.
What is actually happening? In what way is it not working?
Are you getting any error messages?
Can you share an url (all be it via pm)?

Chris
User avatar
chris
Site Admin
 
Posts: 1089
Joined: Mon Dec 17, 2007 7:42 pm
Location: Málaga, Spain

Re: Dates put into form when clicked on in the calendar...

Postby Eddie » Wed Jul 07, 2010 9:30 pm

Hi, thanks.

There is no error as such. The form is working in the page as a standalone form. I made an extra field for the date and thought that the viewer could click on a date and that it would include that date in the email that is sent through the form.

All that happens is you click on a date but it doesn't appear to do anything, no error message but it just doesn't add the date to the form.

I am a complete newcomer and making a site for a friend of my mums but this is proving difficult. I am absolutely sure it is something I am doing wrong and I will PM you with the URL, sorry to be shy but not sure if the site owner will want this public.

Thanks again for your help.
Eddie
 
Posts: 3
Joined: Mon Jul 05, 2010 11:16 am

Re: Dates put into form when clicked on in the calendar...

Postby chris » Thu Jul 08, 2010 12:03 am

Hi Eddie, thanks for the pm.

Quite a few people don't want or can't share the url publicly so that is not a problem.

You have to problems here.
The first one is simple a typing error - you have not closed the "id" atribute.
You have
Code: Select all
<input size="45" id="date name="date" />

that should be:
Code: Select all
<input size="45" id="date" name="date" />


The second issue however is somewhat more complex and is caused by the fact that you are using the iframe method to show the calendar and your form field is in the parent window. So, when you click on the dates the code can't find the field within the document as in reality you have 2 seperate windows (you are getting a JavaScript by the way in that window)

So, you need to adjust that JavaScript function that you added so that it searchs for the "date" field in the parent document.

I'm afraid that I haven't got time to test this right now but I think that you need to replace this line 43 in the mootools-cal-public.js file:
Code: Select all
var dateStart=document.id('date');

with something like this:
Code: Select all
var dateStart=$(parent.document.body).getElement('date');

As I say, I haven't tested that and, to be honest, I have never tried/needed to access elements in the parent document as I don't often use iframes so I am not sure of the actual Mootools syntax.
If this doesn't work, I will take a closer look sometime tomorrow.

Hope this helps :)

Chris
User avatar
chris
Site Admin
 
Posts: 1089
Joined: Mon Dec 17, 2007 7:42 pm
Location: Málaga, Spain

Re: Dates put into form when clicked on in the calendar...

Postby chris » Thu Jul 08, 2010 12:24 am

Sorry, I forgot to mention...
There are 2 alternative solutions to the iframe problem:

1. place the form within the iframe file rather than the parent doc (ie in the calendar "index.php" file itself.
2. Integrate the calendar directly into your page via php (requires more work but the end result is better than the "quick and easy" iframe solution.

Chris
User avatar
chris
Site Admin
 
Posts: 1089
Joined: Mon Dec 17, 2007 7:42 pm
Location: Málaga, Spain


Return to Support

Who is online

Users browsing this forum: No registered users and 2 guests

cron