473,788 Members | 2,843 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Form Submission: Final URL that has form options included ??

Hi there
I am trying to do the following with no luck:

I want to have a form with two select menus. Each menu will obvisouly
have different options, each with its own value. Then quite simply,
when the user clicks on the submit button, I want the resulting URL to
include options from the select fields ( ie: whatever the user has
selected.)

For eg: for a date URL, the final URL might be:

'http://www.comics.com/' +day+ '/' +month+ '/garfield.gif'

Hope this makes sense, and appreciate any assistance.
Thanks,
Jared
Jul 20 '05 #1
5 2666

"Jared" <ja************ **@iqpc.co.uk> wrote in message
news:47******** *************** ***@posting.goo gle.com...
Hi there
I am trying to do the following with no luck:

I want to have a form with two select menus. Each menu will obvisouly
have different options, each with its own value. Then quite simply,
when the user clicks on the submit button, I want the resulting URL to
include options from the select fields ( ie: whatever the user has
selected.)

For eg: for a date URL, the final URL might be:

'http://www.comics.com/' +day+ '/' +month+ '/garfield.gif'

Hope this makes sense, and appreciate any assistance.
Thanks,
Jared


Well, I'm not one hundred what you mean, but maybe this is useful...

You could create hidden fields to hold the values of the options selected in
your select boxes, and change their values whenever an option is clicked,
like this:

<select name="selectBox Day" id="selectBoxDa y"
onChange="this. form.day=this.o ptions[this.selectedIn dex].value;">
//options
</select>
<select name="selectBox Month" id="selectBoxMo nth"
onChange="this. form.month=this .options[this.selectedIn dex].value;">
//options
</select>

<input name="day" type="hidden" value="">
<input name="month" type="hidden" value="">

- not sure if the onChange syntax is correct, since I haven't checked it ;)

Would this help?

Daniel

--
There are 10 kinds of people: Those who know binary and those who don't.
Jul 20 '05 #2
Does the url have to be in this format? If not then why don't you just use
method="get" in the form tag, this will display something like:-

'http://www.comics.com/nextpage.html?o ption1=one&opti on2=two&option3 =three'

Then if you want to pull it out of the querystring on the backend with JS or
Serverside script it should be easier for you.

Hope that helps.

Stu

"Jared" <ja************ **@iqpc.co.uk> wrote in message
news:47******** *************** ***@posting.goo gle.com...
Hi there
I am trying to do the following with no luck:

I want to have a form with two select menus. Each menu will obvisouly
have different options, each with its own value. Then quite simply,
when the user clicks on the submit button, I want the resulting URL to
include options from the select fields ( ie: whatever the user has
selected.)

For eg: for a date URL, the final URL might be:

'http://www.comics.com/' +day+ '/' +month+ '/garfield.gif'

Hope this makes sense, and appreciate any assistance.
Thanks,
Jared

Jul 20 '05 #3
This will generate the required URL pattern:

http://www.comics.com/04/05/page.htm

This will not submit the form however, so the destination page will not be
able to read any POST/GET form variables.

The call to the javascript can be placed in the form tag as an onSubmit
event, or on a button in the form as an onClick event.

<script type="text/javascript">
function ProcessForm(dom ain,page)
{
var formObject=docu ment.forms['myform'];
var Select1Object=f ormObject.eleme nts['select1'];
var Select1Object=f ormObject.eleme nts['select2'];
var Select1Value=Se lect1Object.opt ions[Select1Object.s electedIndex].value;
var Select2Value=Se lect2Object.opt ions[Select2Object.s electedIndex].value;

if(Select1Value =='null')
{
return false;
}

if(Select2Value =='null')
{
return false;
}

window.location .href='http://'+domain'/'+Select1Value+ '/'+Select2Value+ '/'+p
age;
}
</script>

....

<form name="myform" action="#"
onSubmit="Proce ssForm('www.com ics.com','page. htm'); return false;">
<select name="select1">
<option value="null">Se lect day</option>
<option value="01">1</option>
....
<option value="31">31</option>
</select>
<select name="select2">
<option value="null">Se lect month</option>
<option value="01">Janu ary</option>
....
<option value="12">Dece mber</option>
</select>
<input type="submit" value="Go">
<input type="button" value="Go"
onClick="Proces sForm('www.comi cs.com','page.h tm'); return false;">
</form>

"Jared" <ja************ **@iqpc.co.uk> wrote in message
news:47******** *************** ***@posting.goo gle.com...
Hi there
I am trying to do the following with no luck:

I want to have a form with two select menus. Each menu will obvisouly
have different options, each with its own value. Then quite simply,
when the user clicks on the submit button, I want the resulting URL to
include options from the select fields ( ie: whatever the user has
selected.)

For eg: for a date URL, the final URL might be:

'http://www.comics.com/' +day+ '/' +month+ '/garfield.gif'
Do you just want to generate the above URL pattern, or do you want to submit
the form variables (day, month) as well?

Hope this makes sense, and appreciate any assistance.
Thanks,
Jared

Jul 20 '05 #4
"Jared" <ja************ **@iqpc.co.uk> schrieb im Newsbeitrag
news:47******** *************** ***@posting.goo gle.com...
Hi there
I am trying to do the following with no luck:

I want to have a form with two select menus. Each menu will obvisouly
have different options, each with its own value. Then quite simply,
when the user clicks on the submit button, I want the resulting URL to
include options from the select fields ( ie: whatever the user has
selected.)

For eg: for a date URL, the final URL might be:

'http://www.comics.com/' +day+ '/' +month+ '/garfield.gif'

Hope this makes sense, and appreciate any assistance.
Thanks,
Jared


You could try something like (not tested):

<form name="myform" action="" method="post"
onSubmit="docum ent.myform.acti on='http://www.comics.com/' +
document.myform .day.value + '/' + document.myform .month.value +
'/garfield.gif'">

I am sorry I have no time to figure this out in detail; maybe you have to
make a onClick on the submit button instead of an onSubmit in the form tag.

You can also go another way:

<form name="myform" action="http://www.comics.com/garfield.htm"
method="get">

this loads an url with a query string:
http://www.comics.com/garfield.htm?d...onth=yourmonth

And you create a document garfield.htm with a script that parses the query
string and loads the appropriate gif.

hth
--
Markus
Jul 20 '05 #5
Thanks all for the help - using the different posts I have com up woth a solution.

Thanks again !
Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
2021
by: Tom | last post by:
I have created the following code for a product select/payment form (don't know if there is a better way) and I have been trying to make the following changes (unsuccessfully so far): 1) Eliminate the submit button and submit the form with onchange. 2) Open the action php page in a new window. I am using this code for different payment options (i.e., cc processing and paypal). As such, there are multiple forms on the page. The...
19
3000
by: Pete | last post by:
I have form/select which executes a function using onchange. No problem. However, when I validate the page with a strict HTML 4.01 doctype at http://validator.w3.org, it demands either an action or a method for the form?. If I give it an empty action <form action="" ..... it validates OK. Is this acceptable or is there a better/standards correct way? Thanks.
3
4344
by: John Dunlop | last post by:
(Note crosspost and follow-ups to ciwah.) Nicolas Keller wrote in thread "Differences in form handling btw Mozilla and IE?": > The problem: I'm using a form that submit's (POST) its data via three > different image buttons (depending on which button you click, > something different should happen): > > <form action="id.php" method="post" name="form2">
16
6171
by: lawrence | last post by:
I was told in another newsgroup (about XML, I was wondering how to control user input) that most modern browsers empower the designer to cast the user created input to a particular character encoding. This arose in answer to my question about how to control user input. I had complained that I had users who wrote articles in Microsoft Word or WordPerfect and then input that to the web through a textarea box on a form I'd created. I've...
0
1518
by: Piotr Nienaltowski | last post by:
!!! DEADLINE FOR PAPER SUBMISSIONS HAS BEEN EXTENDED UNTIL FEBRUARY 26, 2004 !!! ---------------------------------------------------------------- .NET TECHNOLOGIES 2004 2nd International Workshop on .NET Technologies University of West Bohemia Pilsen (Czech Republic) May 31 - June 2, 2004
4
10559
by: mparisi | last post by:
I have a responsibility within my testing department to automate the submission of data on 4 sequential asp pages. Here's the tasks: 1. Sign in 2. Enter form data and submit 3. Enter more form data and submit 4. Upload file and submit all data The final submission is an accumulation of data from the previous steps(minus the sign in). Can anyone point me to some sample code or
6
3059
by: brettev | last post by:
World, I work at a university where the professors have a system to input grades for assignments and calculate final grades, which is output to an excel file. they are then required to get on a different system and click radio buttons in a form to input final grades. i would like to automate this by doing some sort of automated form submission that grabs the information from the excel sheet and selects the correct radio button and then...
4
1704
by: JLupear | last post by:
My friend and I are trying to start a business and are writing a website of our own. We have been trying to create an online estimator and are having trouble with writing the javascript that is to handle the form data. I am having trouble capturing the form data for use using the onsubmit operator. We have written all of the options using list boxes using numbers as the values. I have attempted to create a user defined function to caculate...
1
1952
by: hotrod57 | last post by:
I am trying to append the results from a form to a text file. My code is supposed to print out the results on one page, and append the results to another page each time data is entered on the form and the submit button is hit. Unfortunately, it is only printing out the message acknowledging the submit button--no data on either form. Here is the code below, please help if you can. PHP code that reads the form submission: <?php function...
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10366
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10175
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10112
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9969
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5399
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3675
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.