SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard lukeurtnowski's Avatar
    Join Date
    Mar 2003
    Location
    Coronado
    Posts
    1,582
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    submitting a form using the onchange event

    why doesn't this form get submitted once the onchange event is triggered (I thought that it gets triggered once the element is used?)

    http://fixmysite.us/asp/providers/test.php
    Thanks...
    "Oh, and Jenkins--apparently your mother died this morning."

  2. #2
    SitePoint Addict Mal Curtis's Avatar
    Join Date
    Jul 2009
    Location
    New Zealand
    Posts
    327
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by lukeurtnowski View Post
    why doesn't this form get submitted once the onchange event is triggered (I thought that it gets triggered once the element is used?)

    http://fixmysite.us/asp/providers/test.php
    Thanks...
    Try changing the name & id of the 'Submit' button from 'submit'. I imagine that the this.form.submit reference is referring to the input element, not the event method.

  3. #3
    SitePoint Wizard lukeurtnowski's Avatar
    Join Date
    Mar 2003
    Location
    Coronado
    Posts
    1,582
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    that did not help (I probably messed up) but I changed the name of the submit button to upload (When I use the onChange event, It doesn't seem to find the $_POST['upload'] variable
    http://fixmysite.us/asp/providers/test1.php
    I have this if statement in upload.processor.php
    PHP Code:
    // check the upload form was actually submitted else print the form
    isset($_POST['upload'])
        or 
    error('the upload form is neaded'$uploadForm); 
    But seems to see it if the submit button is clicked here
    http://fixmysite.us/asp/providers/test.php
    Is that right? why doesnt the event act as if the submit button is clicked?

    Let me explain what I'm trying to do as you might have a better way for me to do this...
    I'm trying to upload an image the moment the onchange evert is triggered so that the image in thumbnail size appears so that the upload is confirmed to the stupid, also how can this be done without refreshing the page as ill have abnother form on the page I dont want to reset?

    Thanks a lot...
    "Oh, and Jenkins--apparently your mother died this morning."

  4. #4
    SitePoint Addict Mal Curtis's Avatar
    Join Date
    Jul 2009
    Location
    New Zealand
    Posts
    327
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)
    I believe that the 'upload' value won't be sent unless you explicitly click the Submit button. I'd put in a hidden input 'form_marker' with a value of the name of the form you're submitting. Then you can check for $_POST['form_marker'] == 'form_name' in your PHP code.

    Re: the inline submitting, are you avoiding using an existing library for a reason? If you're not adverse to trying an existing script, I'd recommend using http://www.plupload.com/


Bookmarks

Posting Permissions

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