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 8 of 8
  1. #1
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts

    submit buttons without JS?

    HI,

    I have a submit button in my site for the feedback form. I noticed yesterday that if I switch off JS, that it doesn;t work any longer. surely there is an alternative which doenst need JS? I lkooked at the buttons here, in this site, and they seem to be coded just like mine.

    Now I know you'll say to me that there's a big lump of JS there. I know but, I have that for people who have JS on (the majority), to check their entry. I shall remove it when I put together the perl snippet which can replace that.

    However, whether the user has JS on or not, I still want them to be able to submit the form.

    [code]
    <input class="submitbuttons" type="button" onClick="javascript:checkFields();"
    value="Preview">
    [code]

    Bazz
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • #2
    Senior Coder
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    2,636
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Would it work if you made it a submit button?

    <input class="submitbuttons" type="submit" onClick="javascript:checkFields();" value="Preview">

  • #3
    Regular Coder
    Join Date
    Jul 2005
    Location
    Halifax, Nova Scotia, Canada
    Posts
    392
    Thanks
    1
    Thanked 0 Times in 0 Posts
    You are using a javascript submit button because you are using javascript to check for required fields on form submit. This means several things. You either don't have the ability to use cgi on your host or you are unsure of how to set it up. You cannot then use required fields without javascript. If you disable the javascript in the submit buttom people can send blank forms to you.
    Once I thought I was wrong but I was mistaken.

  • #4
    Senior Coder
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    2,636
    Thanks
    0
    Thanked 0 Times in 0 Posts
    He said "I shall remove it when I put together the perl snippet which can replace that."

    He just wants something for the time being so that if they don't have javascript enabled the form can still be submitted. I think.

  • #5
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,471
    Thanks
    8
    Thanked 1,085 Times in 1,076 Posts
    Bazz ....

    You should validate form with Perl ...

    But, as for the Javascript thing, I know why you want to use it ...
    because the validation works good and keeps the visitor on the
    client side until the form is complete.

    How about using the <noscript> tag, where you have both lines ...
    something like this (but I didn't test it out):

    <input class="submitbuttons" type="submit" onClick="javascript:checkFields();" value="Preview">
    <noscript><input type="submit" value="Submit"></noscript>

    Where <noscript> is executed if Javascripting is not enabled.

    Or, enclose a complete separate <form> within <noscript> ...

  • #6
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    spot on mark87 and thanks all.

    I'll try the submit/button thing mark as I had missed that earlier.

    Blimey Max, that sounds like a duplication . I dislike that concept so I'd better put together a perl thing in the next day or so - before I forget - as I start to add more to this 'project'

    Bazz
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • #7
    Regular Coder
    Join Date
    Jul 2005
    Location
    Halifax, Nova Scotia, Canada
    Posts
    392
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Yeah, it'd probably be better to just devote all your time and energy into the new perl script instead of having a mediating step in the process. Didn't catch that that was what you were up to. I still prefer PHP for all of this sort of stuff myself though.

    PHP for President!
    Once I thought I was wrong but I was mistaken.

  • #8
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    Yeh, I'm gonna do the perl checker/validator over the weekend If I have time. But changing the 'button' to 'submit' made it work even if JS is off, though because it is a risk that was previously exploited, I shall leave it as is until I get the perl done.

    Come to think of it... Thats why I had it that way. If the sender wasn;t going to tell me who they were, my site wasn;t going to let them send the form.
    And to think it seems like it was someone who knows me, who exploited it before..
    Thwack and double thwack!!

    Thanks Guys.

    Bazz
    Last edited by bazz; 08-23-2005 at 06:06 PM.
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link


  •  

    Posting Permissions

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