We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Show XML as webpage

ambientsbs
ambientsbs asked
on
Medium Priority
180 Views
Last Modified: 2012-05-11
Hello Experts!

I've searched the entire Internet looking for an answer to this question and am hoping that someone here can help me figure out how to do this:

I want to create a webpage with a form that has just a few fields. Those fields would be "location", "size", and "gender". Once somebody enters one or all of the values in this form and presses Submit, I would like a URL passed to an XSLT page (which is an XML source) containing the values that were selected.

So, for instance, someone selects Austin,TX as their location, size as Small, and gender as female from the form. When they click submit, the URL that I then want referenced in my XSLT page that would then open would be
http://www.mydomain.com/pet.find?key=12345&sex=F&location=austin,tx&size=small.


Can ANYONE tell me how to do this?? Thank you in advance!!!
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2015

Commented:
I'm thinking you would want users to select sex and size from dropdowns or checkboxes. With javascript you could redirect with something like this:

<script type="text/javascript">

var sexObj = document.getElementById('sexOption');
var selIndex = sexObj.selectedIndex;
var locText = documentGetElementById("locTextbox").value;
var sizeObj = document.GetElementById('sizeOption');
var sizeIndex = sizeObj.selectedIndex;

function onSubmit() {
    window.location = "http://www.domain.com/pet.find?key=12345&sex=" + sexObj.options[selIndex].value + "&location=" + locText + "&size=" + sizeObj.options[sizeIndex].value;
}

</script>

Author

Commented:
Thanks for the feedback! I definitely agree that the sex and size should be dropdowns and would create them like that.

So from what I'm reading, clicking the I would be setting up the form so that once someone clicks "submit" they would be redirected to the www.domain.com/pet.find?....?

That leads me to 2 questions:

1. I would want to REQUIRE that someone enter a location, but the size and sex aren't necessary. Would this javascript work correctly in the case that they were to leave those other fields blank?

2. Using this method, how do I tie my xml stylesheet to the www.domain.com/pet.find?..... page?

Thank you so much !
CERTIFIED EXPERT
Top Expert 2015
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Thanks for the feedback and sorry for the delayed reply.

Makes sense about your first thought, but I do have an issue with the 2nd. The URL that I'm generating, www.domain.com/pet.find?..., with the variables from the form I'm creating, is not pulling from a server that I have control over. So, it doesn't seem as if I'd be able to setup a server-side script for this.

What I would like to do is have somebody click the "Submit" button on the form and redirect to a page on MY server that then references the URL created above and an XML stylesheet that turns that data into something that looks nice. Any suggestions on how to do this?
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.