Hi Monami,

On 05/05/15 13:16, Monami Bhattacharya wrote:
> Is it possible to add an interactive HTML "Contact Us" or "Feedback"
> form to a Sphinx generated static site? How? Expected to appear in the
> toctree same as any other topic/chapter. Am using the sphinx_rtd_theme.

I do this using a page `contact.rst` with a "raw html" directive as in
the following example (sorry for the user texts in German but I guess
that you can imagine what they mean). This requires of course a
formmailer script which processes the submitted form data, and this
script must be implemented separately at the URL specified at <FORM
action="...">

Kontakt
=======

.. raw:: html


  <script type="text/javascript">
  function checkForm() {
    document.calledfrom.value=window.location.href;
    if (document.feedback.comment.value == "") {
      alert("'Kommentar' darf nicht leer sein!);
      document.feedback.comment.focus();
      return false;
    }
    if (document.feedback.name.value == "") {
      alert("'Ihr Name' darf nicht leer sein!);
      document.feedback.name.focus();
      return false;
    }
    if (document.feedback.email.value == "") {
      alert("'Ihre E-Mail-Adresse' darf nicht leer sein!);
      document.feedback.email.focus();
      return false;
    }
  }
  </script>

  <FORM name=feedback
  action=http://www.example.com/formmail/form.py/email
  method=post onsubmit="return checkForm()">

  <h4>1. Obligatorische Angaben</h4>

  <TABLE class="form">

  <TR>
  <TD><P>Kommentar:</p></TD>
  <TD><TEXTAREA name="comment" rows=10 cols=40></TEXTAREA>
  </TD></TR>

  <TR>     <TD>Ihr Name:</TD>
  <TD><INPUT class=searchbox size=30 name=name> </TD></TR>

  <TR>
  <TD>Ihre E-Mail-Adresse:</TD>
  <TD><INPUT class=searchbox size=30 name=email>

  </TD></TR>

  </TABLE>

  <h4>2. Fakultative Angaben</h4>

  <TABLE class="form">
  <TR> <TD>Postadresse</TD><TD>
  <TEXTAREA name="r_postadresse" rows=3 cols=40></TEXTAREA>
  </TD></TR>

  <TR> <TD>Telefon:</TD><TD>

  <INPUT class=searchbox size=30 name=f_phone>
  </TD></TR>

  <TR> <TD>Skypename:</TD><TD>
  <INPUT class=searchbox size=30 name=f_skype>
  </TD></TR>

  </TABLE>

  <INPUT type=hidden name=calledfrom
    value="http://www.example.com/contact.html";
  <INPUT type=hidden name=_response_ok
    value="http://www.example.com/contact-ok.html";>
  <INPUT type=hidden name=_recipient
    value="[email protected]">

  <INPUT class=searchbtn type=submit
         value="Senden"
         name=__>
  <INPUT class=searchbtn type=reset
         value="L&ouml;schen"
         name=__>

  </FORM>


I also have a page contact-ok.rst to be displayed upon success
(specified in the hidden input named "_response_ok") with this content:

:orphan: http://sphinx.pocoo.org/markup/misc.html#file-wide-metadata

Kontakt - OK
============

Ihre Rückmeldung wurde abgeschickt,
und wir werden sie so schnell wie möglich beantworten.

HTH,
Luc

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sphinx-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to