On May 24, 10:46 pm, phx <[email protected]> wrote:
> Hey group,
>
> im trying to simple submit some form data per post to a javascript
> function, but it doesnt work for me.

It is always handy to start with valid markup, try the W3C markup
validation service:

<URL: http://validator.w3.org/ >


> My form looks like:
>
>     <form id="add_server" name="add_server" title="TestForm"
> class="dialog" action="" onSubmit="addServer();" method="POST">
>         <fieldset>
>             <a class="button leftButton" type="cancel">Cancel</a>

The type attribute for an A element is supposed to be a hint at the
content type of the resource linked to by the URI in the href
attribute:

<URL: http://www.w3.org/TR/html401/struct/links.html#adef-type-A >

I don't think there is a content type of "cancel".  If you are trying
to create a reset button, then:

  <input type="reset" value="Cancel">

If you are trying to create image buttons, use a button element with
an image as a child node.


>                 <label>Data1</label>

A label element should either have a for attribute to link it to a
form control, or have the related form control as a child element (or
both).  The above element has neither, so it is roughly equivalent to
a span element.


>                 <input id="text" type="text" name="data1" />
>                 <label>Data2</label>
>                 <input type="text" name="data2"/>
>                 <label>Data3</label>
>                 <input type="text" name="data3" />
>                                 <a class="whiteButton" type="submit" 
> href="#home">Submit me</a>

As above, "submit" does not appear to be a valid value for an A
element's type attribute.  If you are trying to create a submit
button, use:

  <input type="submit" ...>

or perhaps:

  <input type="image" ...>

<URL: http://www.w3.org/TR/html401/interact/forms.html#adef-type-INPUT
>

>                 </div>
>         </fieldset>
>     </form>
>
> addServer is a JavaScript function located in a separated file (file
> is included).
>
> If i press Submit nothing happened, can you point me in some
> direction?

Your "submit" element isn't a submit button, so the form's submit
event is not fired, the onsubmit event handler isn't called and so
neither is the listener.


> I also don't find anything at Google.

I found lots. :-)


--
Rob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"iPhoneWebDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/iphonewebdev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to