Results 1 to 9 of 9

Thread: [RESOLVED] Submit Form form JS Function

  1. #1

    Thread Starter
    Fanatic Member aconybeare's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    772

    Resolved [RESOLVED] Submit Form form JS Function

    Hi,

    I'm trying to submit a form using javascript on the fly and am changing the action. It works if i change the method to get, but doesn't send the form if the method is post, does anyone have any ideas?

    Page 1
    Code:
    <html>
    <head>
    <script language="javascript">
    <!-- // Begin Hide
    	function goFindPerson(sParent){
    		document.myForm.txtParent.value=sParent;
    		document.myForm.action="findPerson.asp";
    		document.myForm.method="post";
    		document.myForm.submit();
    	}
    
    // End Hide -->
    </script>
    </head>
    <body>
    <form id="myForm" name="myForm" method="post" action="sendMail.asp">
    <input type="hidden" name="txtParent" id="txtParent" />
    <table>
    	<tr>
    		<td>To:</td>
    		<td>
    			<select name="ddlTo" id="ddlTo">
    				<option value="0" selected="selected">[Select]</option>
    				<option value="[email protected]">[email protected]</option>
    				<option value="[email protected]">[email protected]</option>
    			</select>
    			<br />
    			<textarea name="txtTo" id="txtTo" rows="3" cols="75"></textarea>&nbsp
    			<input type="button" onclick="goFindPerson('txtTo')" value="find" />
    		</td>
    	</tr>
    	<tr>
    		<td>&nbsp;</td>
    		<td>&nbsp;</td>
    	</tr>
    </table>
    </form>
    </body>
    </html>
    Page 2
    Code:
    <html>
    <head>
    </head>
    <body>
    <p>
    <%="Form: " & Request.Form("txtParent")
    %>
    </p>
    </body>
    </html>
    Any help or ideas will be greatly appreciated

    Cheers Al

  2. #2

    Thread Starter
    Fanatic Member aconybeare's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    772

    Re: Submit Form form JS Function

    I've managed to narrow the problem down to the fact that I've got a file upload control in the form with the enctype set to "multipart/form-data"

    Which disables Request.Form
    Last edited by aconybeare; Dec 6th, 2005 at 09:30 AM.

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Submit Form form JS Function

    Is there a good reason for not making this two separate forms? That would allow users without JavaScript to use the site.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  4. #4

    Thread Starter
    Fanatic Member aconybeare's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    772

    Re: Submit Form form JS Function

    CornedBee,

    Thanks for your reply.

    The only reason is that all the information on the first form has to be sent on the second form so was trying to get away from creating two forms, (in fact 3 forms because I have two find people links).

    It seemed logical to just change the forms action

    What I'm trying to do is go to another page and search for a person, once a person has been found return to this page and populate all the existing values back in. To do this I'm passing all the values to my find form storing them in hidden fields then sending them back.

    Does this make sense? If you have any ideas of how this could be done better I'd be delighted to hear them

    This is an an application which is to be used internally so we can specify that the users use IE and javascript & cookies have to be enabled

    Cheers Al

  5. #5
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Submit Form form JS Function

    I shudder to think of someone forcing me to use IE...

    But I disgress. The usual solution here is to open, upon a button click, a pop-up where you can select some value to fill in. Not all pop-ups are bad.

    You can see how that's supposed to work on some Invision Power Board, when you search for PM recipients. (This board is vBulletin, it has no such function.)
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  6. #6

    Thread Starter
    Fanatic Member aconybeare's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    772

    Re: Submit Form form JS Function

    CornedBee,

    Are you recommending javascript now?

    My problem is this when a person searches they will get results and will likely want to see a persons full details, for which I plan to provide a popup, so now we have the main page and two popup windows open, starting to get messy.

    I've got the thing working now. But may revisit the popup option later.

    Going back to your aversion to IE, in my experience most (I said most not all!) companies have strict rules on what users can download and install on their PCs that usually includes a browser policy.

    If this thing was for the WWW then it holds true that forcing your users to use a specific bowser is plainly foolish.

  7. #7
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Submit Form form JS Function

    I know that companies have policies. I'd hate to work at one that forced me to use IE, though.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  8. #8

    Thread Starter
    Fanatic Member aconybeare's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    772

    Re: Submit Form form JS Function

    CornedBee,

    I'm curious, what is your problem with IE exactly? Is it microsoft behavioural issues in general or IE specific behavioural issues?

  9. #9
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Submit Form form JS Function

    A bit of both. I have the general issues with MS that you can expect from a Linux geek, but I have more issues with IE6. I dislike the weak standards support very much, and hate the fact that interoperable sites need to support it. The browser is, essentially, totally broken the way I see it. Which may not be the way most others see it.
    At the same time, IE has various proprietary features and deems it unnecessary to mark them as such - take, for example, the scrollbar-* CSS properties. The CSS specification explicitely reserves every single property name not starting with a dash for the standard. In other words, every proprietary extension must start with -, e.g. -scrollbar-arrow-color. The spec also says that vendors should place a vendor sign in front, e.g. -moz-binding for the Mozilla binding property, or -xbl-binding for the XBL specification that Mozilla, Opera and Safari develop together. So the scrollbar properties should be -ie-scrollbar-*.
    It's this complete disregard for standards that wouldn't hurt at all to implement that annoys me most about IE.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

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



Click Here to Expand Forum to Full Width