Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#1 missing_fields_redirect - which fields?

open
nobody
None
5
2004-05-02
2004-05-02
Anonymous
No

Hi :) ... I can send the user to my custom form error
page with "missing_fields_redirect" or I can use the built-
in "required" which will show the name of the missing
field.

Is there a way that I can pass the missing field names
to the form error page?

All help appreciated

Glyn

Discussion

  • Logged In: NO

    Hmm ... I've found a neat workaround in case there's no
    other solution ... a script which identifies the missing fields
    and adds a search string to the missing_fields_redirect URL.

    The error page can decode the search string to report on
    which fields are missing:

    In the form ...

    function validate() {
    errorURL = "baseURL/form_error.html?"
    if (document.forms[0].email.value == "" ) errorURL =
    errorURL + "Email%20Address%20%20";
    if (document.forms[0].Contact_Name.value == "" )
    errorURL = errorURL + "Contact%20Person%20%20";
    if (document.forms[0].Phone.value == "" ) errorURL
    = errorURL + "Phone%20Number%20%20";
    document.forms[0].missing_fields_redirect.value =
    errorURL
    }

    ... and in the error page ...

    document.write("The following fields on your form must be
    completed<br><br>"
    + unescape(location.search.substr(1))
    )