It is now working in my sandbox. Thanks a ton, Luc!
My server's running on Nginx which didn't run the php script automatically.
Had to install php5, edit the sites file to enable php fastcgi_pass block,
etc.
On Monday, May 11, 2015 at 7:03:24 PM UTC+5:30, Luc Saffre wrote:
>
> Hi Monami,
>
> as I said: 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="...">
>
> Surf the Internet about "formmailer script". You must implement such a
> script independently from your Sphinx documentation. You can use PHP,
> Python, CGI or whatever. Yes, that goes beyond what Sphinx can give
> because it involves accepting and processing dynamic data.
>
> Luc
>
>
> On 11/05/15 14:02, Monami Bhattacharya wrote:
> > Hey Luc,
> >
> > I tried this today after making minor changes. It renders
> > satisfactorily, thanks! However, onsubmit throws a 405 error saying POST
> > is not supported. Am running it locally on Nginx. Any clue? Here's my
> form:
> > ---
> >
> > ==========
> >
> > Contact Us
> >
> > ==========
> >
> >
> > .. raw:: html
> >
> >
> > <script type="text/javascript">
> >
> > function checkForm() {
> >
> > document.calledfrom.value=window.location.href;
> >
> > if (document.feedback.comment.value == "") {
> >
> > alert("'Comment' must not be blank!);
> >
> > document.feedback.comment.focus();
> >
> > return false;
> >
> > }
> >
> > if (document.feedback.name.value == "") {
> >
> > alert("'Name' must not be blank!);
> >
> > document.feedback.name.focus();
> >
> > return false;
> >
> > }
> >
> > if (document.feedback.email.value == "") {
> >
> > alert("'E-mail' must not be blank!);
> >
> > document.feedback.email.focus();
> >
> > return false;
> >
> > }
> >
> > var link = "mailto:[email protected] <javascript:>"
> >
> > + "&subject=" + escape("Feedback")
> >
> > + "&body=" + escape(document.feedback.name.value);
> >
> > window.location.href = link;
> >
> > }
> >
> > </script>
> >
> >
> > <FORM name=feedback action="contact.html" method=post onsubmit="return
> > checkForm()">
> >
> >
> > <h5>Was this information helpful?</h5>
> >
> >
> > <TABLE class="form">
> >
> >
> > <TR>
> >
> > <TD><P><b>Comment:</b></p></TD>
> >
> > <TD><TEXTAREA name="comment" rows=10 cols=40></TEXTAREA> </TD>
> >
> > </TR>
> >
> >
> > <TR>
> >
> > <TD><b>Name:</b></TD>
> >
> > <TD><INPUT class=searchbox size=30 name=name> </TD>
> >
> > </TR>
> >
> >
> > <TR>
> >
> > <TD><b>E-mail:</b></TD>
> >
> > <TD><INPUT class=searchbox size=30 name=email> </TD>
> >
> > </TR>
> >
> >
> > <TR>
> >
> > <TD><b>Location:</b></TD>
> >
> > <TD><TEXTAREA name="r_location" rows=1 cols=40></TEXTAREA> </TD>
> >
> > </TR>
> >
> >
> > <TR>
> >
> > <TD><b>Phone:</b></TD>
> >
> > <TD><INPUT class=searchbox size=30 name=f_phone> </TD>
> >
> > </TR>
> >
> >
> > </TABLE>
> >
> > <p></p>
> >
> > <INPUT type=hidden name=calledfrom
> >
> > value="contact.html"
> >
> > <INPUT type=hidden name=_response_ok
> >
> > value="contact_OK.html">
> >
> > <INPUT type=hidden name=_recipient
> >
> > value="[email protected] <javascript:>">
> >
> >
> > <INPUT class=searchbtn type=submit
> >
> > value="Send"
> >
> > name=__>
> >
> > <INPUT class=searchbtn type=reset
> >
> > value="Clear"
> >
> > name=__>
> >
> >
> > </FORM>
> >
> > <p></p>
> >
> >
> > ---
> >
> > On Tuesday, May 5, 2015 at 5:56:39 PM UTC+5:30, Luc Saffre wrote:
> >
> > 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
> > <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
> > <http://www.example.com/contact.html>"
> > <INPUT type=hidden name=_response_ok
> > value="http://www.example.com/contact-ok.html
> > <http://www.example.com/contact-ok.html>">
> > <INPUT type=hidden name=_recipient
> > value="[email protected] <javascript:>">
> >
> > <INPUT class=searchbtn type=submit
> > value="Senden"
> > name=__>
> > <INPUT class=searchbtn type=reset
> > value="Lö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
> > <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] <javascript:>
> > <mailto:[email protected] <javascript:>>.
> > To post to this group, send email to [email protected]
> <javascript:>
> > <mailto:[email protected] <javascript:>>.
> > Visit this group at http://groups.google.com/group/sphinx-users.
> > For more options, visit https://groups.google.com/d/optout.
>
>
--
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.