/    Sign up×
Community /Pin to ProfileBookmark

Fill out a form field

How do I fill out a form field when people click on a link,
I am trying to set up a calendar, where people and click on a date and book for that day, but instead of making a seperate page for every date I want it to automaticly fill out the date field in the form from when they click on the link, can it be done.

Please help

Thanks

to post a comment
HTML

15 Comments(s)

Copy linkTweet thisAlerts:
@mickolauthorFeb 20.2004 — Is anyone going to help me
Copy linkTweet thisAlerts:
@hammerslaneFeb 20.2004 — i'm not really sure what you're asking... but about the date thing... maybe [url=http://www.cyc.co.uk/tide/tide_times.html]this[/url] is the kind of thing you're looking for?

not sure to be sure me self...
Copy linkTweet thisAlerts:
@mickolauthorFeb 20.2004 — That might help me, but what I am trying to do is when someone clicks on a link; the link somehow fills out a field on a form that will open up, so that I can have one form page but each of the links to that page adds a different value to a field on the form, a bit like the mailto email link where you put ?subject= at the end and what ever is at the end when someone clicks on it the subject field will be filled with the subject value in the link.
Copy linkTweet thisAlerts:
@buntineFeb 20.2004 — Something like this.

<i>
</i>&lt;form name="myForm"&gt;
&lt;input type="text" name="theDate" size="25" /&gt;
&lt;a href="#" onclick="return fillForm();"&gt;Get date&lt;/a&gt;
&lt;/form&gt;


<i>
</i>function fillForm() {
var dateCtrl = document.getElementsByName("theDate")(0);
var currDate = new Date().getDate();

dateCtrl.value = currDate;
return false;
}
Copy linkTweet thisAlerts:
@mickolauthorFeb 22.2004 — No I do not need the current date I need it to fill a form field on another with a value I select, when a link is clicked
Copy linkTweet thisAlerts:
@buntineFeb 22.2004 — I have no idea what your talking about now... You will need to explain in alot more detail exactly what your trying to do.

Regards.
Copy linkTweet thisAlerts:
@mickolauthorFeb 23.2004 — Could I email someone some files I am working with so you can see what I mean
Copy linkTweet thisAlerts:
@hammerslaneFeb 24.2004 — can you attach them?
Copy linkTweet thisAlerts:
@mickolauthorFeb 24.2004 — Attached are two html files in a zip file, What I would like to do is the file called BookMar2004.htm has a calandar table on it and I would like it that when you click on a box (the day/date) that you wish to book and it opens up the booking form, but the date requested field is filled because of the link (day/date) you clicked on the calandar, so I would only need one form and not one form for every day of the year

[upl-file uuid=74354b2b-684c-47ad-87b6-98126647f699 size=2kB]html.zip[/upl-file]
Copy linkTweet thisAlerts:
@mickolauthorFeb 25.2004 — I have seen that the file has been downloaded 5 times can any one help me so far
Copy linkTweet thisAlerts:
@hammerslaneFeb 26.2004 — can you be more specific (i know, we must seem really dumb), but saying stuff like "and it opens up the booking form" - do you mean a popup?

if you try to explain exactly what you want to achieve with this form/calendar/thing , rather than step by step what you want to happen, maybe we can fully understand what you're trying to do.
Copy linkTweet thisAlerts:
@mickolauthorFeb 26.2004 — I would like the calendar to allow people to book online and they can select the date from the calendar and it automatically fills the date field on the form, and it changes if someone clicks on a different date on the calandar. So only one form is required
Copy linkTweet thisAlerts:
@Paul_JrFeb 27.2004 — Well, I don't know much about JS, and I don't know a thing about passing strings from page to page without using a form, but I managed to get this together. I am positive there's a better way, even with JS, but anyways.

Also, you have to manually enter the text you want to appear in the link.

[upl-file uuid=06ee1cd3-5dae-447e-b42e-caefc1af82e5 size=2kB]parentchild.zip[/upl-file]
Copy linkTweet thisAlerts:
@mickolauthorFeb 27.2004 — Thank You, I believe I can work with that,

Now for another question can you have a reset button on a form, that when you click it, it dosen't clear all of the fields
Copy linkTweet thisAlerts:
@Paul_JrFeb 28.2004 — Heheh, I just noticed Homesite put in two temporary files in the .zip. :o

As for the clearing of certain fields, check the attachment. I just put the names of the fields to be cleared in an array, looped through 'em, and then set their values to be empty. You could also incorporate checkboxes and such into this.

[upl-file uuid=77217021-100e-4630-bc47-134ec59fed2f size=1kB]clear.txt[/upl-file]
×

Success!

Help @mickol spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...