Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 14 of 14
  1. #1
    New Coder
    Join Date
    Jun 2002
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Can You Grab Form Query_String before it is sent?

    Does anyone know if you can grab query_string values before the query_string is sent?

    Obviously you can determine the values of the form attributes but can you get the full value of the http request?

    Hope so....


  • #2
    Regular Coder
    Join Date
    Jun 2002
    Posts
    338
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    function getQueryString(formObj) {
    var qs=formObj.getAttribute("action");
    for(var i=0;i<formObj.elements.length;i++) {
    qs+=formObj.elements[i].value;
    }
    alert(qs);
    }
    Then, add it to the onsubmit event handler of the form object.

    Hope that helps!

    Happy coding!

  • #3
    New Coder
    Join Date
    Jun 2002
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Stymied

    Thanks for the code nolachrymose!

    I did add it to the form tag but it never executes.

    I am using document.forms.frmMyForm.submit();

    Will this not work when using the submit() method?

    Thanks again....

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    The Planet Earth Code Poet: True
    Posts
    282
    Thanks
    0
    Thanked 1 Time in 1 Post
    Are you using an onsubmit event handler in your form tag? Maybe something like this:

    <form onsubmit="return getQueryString(frmMyForm)" ...

  • #5
    New Coder
    Join Date
    Jun 2002
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts

    form method is "get"

    The form method is get..the action is set to return the funtion;

    I am using one form to get values and then I wand to submit one of two forms based on the values of the 1st form...to an iframe

    <parent form>
    calls
    form1.submit();
    form2.submit();

    <form1 action="get">
    <form2 action="post">

    two seperate methods both being called from

    submit();

    I think that this should be easier than it is...

  • #6
    Regular Coder
    Join Date
    Jun 2002
    Location
    The Planet Earth Code Poet: True
    Posts
    282
    Thanks
    0
    Thanked 1 Time in 1 Post
    I bet the whole process could be easier. Why don't you tell us what you are ultimately trying to do so we can help you out with the whole process.

  • #7
    New Coder
    Join Date
    Jun 2002
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts

    objective

    I have a form that gets the values to be used by another form based on of the selected objects values.

    if obj = "a" then form1.submit();
    if obj = "b" then form2.submit();

    I want the iframe to display the result output from the form querystring that is being sent...

    I was thinking if I know the query_string, I could just set the iframe.location to the value of the query_string...

    What is the best way to target a iframe from JavaScript.

    I have tried window.framname.location = document.forms.myForm.submit();
    but that doesn't work ;(

    Thanks to all!

  • #8
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    What is the best way to target a iframe from JavaScript.
    document.forms.yourFormNameHere.target="yourTargetWindowOrFrameNameHere"

  • #9
    New Coder
    Join Date
    Jun 2002
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts

    iframe.target!

    Thanks Roy! I should have tried that....

    Now how do I force a submit() to display to that target??!?

  • #10
    Regular Coder
    Join Date
    Jun 2002
    Location
    The Planet Earth Code Poet: True
    Posts
    282
    Thanks
    0
    Thanked 1 Time in 1 Post
    You can target a specifc frame inside the form tag. For example if I wanted the final result of a form submission to aprea in a specific frame I simply add a target attribute to the form tag:

    <form method="get" target="FrameNameHere" ...


    then when this frame gets submitted the reults display in the frame I targeted.

  • #11
    New Coder
    Join Date
    Jun 2002
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up Excellent!

    You guys are the BEST !!!

    Thanks again for prompt and insightful posts!

  • #12
    New Coder
    Join Date
    Jun 2002
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question More ???s

    Sorry to be such a pest..but I gotta know!

    Can these be done?

    1. iframe.style.visibility = "visible"
    errors: style is unknown or not an object (style is set to "hidden")

    2. iframe.target or location = "_blank"
    errors: "Permission Denied!"

    Thanks again.......

  • #13
    New Coder
    Join Date
    Jun 2002
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy 1/2 way there..

    I was able to set the visibility of the iframe using:

    document.getElementById("frameID").style.visibility='hidden';

    However I am still unable to target the iframe if the frame has a URL loaded into it...

    window.top.frames['frameID'].document.location.href.value ='about:blank'; //errors "Access Is Denied!"

    window.top.frames['frameID'].document.target ='about:blank'; //errors "Access Is Denied!"

    Is this a violation of the DOM?!?!

  • #14
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If your document that's been loaded into your iframe does not lie in the same domain as the document that contains the iframe, and you try to access the iframe document via javascript, you are violating the so-called Same Origin Policy.

    That's a very strict security feature that can't be circumvented.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •