Passing form action value to a url(Link)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jankie
    New Member
    • May 2007
    • 58

    Passing form action value to a url(Link)

    hi all,

    I am in a situation where I need a form inside another.
    The nested form asks the user to scan their file,takes the posted file and sends it to a web url.The parent form submits the user input plus the scanned file.

    Given that html does not allow nested forms,is it possible to turn the action value in the nested form into a link?
    [code=html]
    <form name="name" action=http://www.somedomain. com/ method=post
    target=some_pop _up_window encType=multipa rt/form-data>[/code]
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, Jankie.

    Let me see if I understand what you are trying to do. So you want the User to upload a file, then fill out the rest of the form and submit the whole thing. Is that correct?

    Does the script require that the file be submitted first? Or can you put everything in one form?

    Comment

    • Jankie
      New Member
      • May 2007
      • 58

      #3
      Thank you pbmods for your response .Appreciate it everytime you are ready to share insights.
      Ok,I have one form that collects usual user info plus the ability to attach a file.
      User fills in form,before they reach upload section(always in the same form)they encounter a little box(what i call a nested form with its own action set to a scanning url)that offers that they scan the file before uploading it.Once scanned,they submit everything at one click(by clicking the submit button of the parent form).
      The problem i cannot have 2 actions at the same time.

      Parent form
      <form name="parentFor m" action=process. php>
      <LABEL for=Upload_File >Upload File</LABEL>
      <input type="hidden" name="MAX_FILE_ SIZE" value="300000">
      <INPUT type="file" name="userfile" >
      </form>

      Nested form //supposing

      <form name="ScanForm" action=http://www.somedomain. com/ method=post
      target=some_pop _up_window encType=multipa rt/form-data>
      <INPUT input type=file name=file size=12>
      <INPUT type=image src="/scan.gif" onclick="return do_scan_file(); ">
      </FORM>

      So far, i tried combining the scan form into the parent form

      Parent form
      <form name="parentFor m" action=process. php>
      <LABEL for=Upload_File >Upload File</LABEL>
      <input type="hidden" name="MAX_FILE_ SIZE" value="300000">
      <INPUT type="file" name="userfile" >
      <INPUT type=image src="/scan.gif" onclick="return do_scan_file(); ">
      </form>

      What am trying to do now is replacing the :
      <INPUT type=image src="/scan.gif" onclick="return do_scan_file(); ">
      with a simple link,that takes the selected file for scanning and send it to a web-based scanning url,without the use of a "encType=multip art/form-data" that requieres a form tag.

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #4
        Heya, Jankie.

        Ok. I think I see what you're going for here. The problem is that in order to submit a form, you pretty much have to go to a new page. The other problem is that to upload a file (for security reasons) you definietely have to go to a new page.

        The way I (and eBay, so it seems) do it is to either use a pop-up window or an iframe to upload the file.

        You could do something like this:

        [code=html]
        <form action="page1.p hp">
        <input name="fileScann ed" type="hidden" value="" />
        .
        .
        .
        </form>

        <iframe src="filePfhorm .php"></iframe>
        [/code]

        filePfhorm.php would contain the 'nested' form.

        Comment

        Working...