Help - Search - Members - Calendar
Full Version: Combining two forms for Mail-outs
Movable Type Community Forum > Additional Resources > Tips and Tricks
medic119
I am not a great coder by any means.  I can hold my own, but when things start to get weird, I go for help.

Anyway, I have been playing with Bloglet and considering using it for notifications instead of the MT Notifications screen.  However I got to thinking about giving my users a choice.

My problem is that I would like one Area for subscriptions, where if someone checked a box that said "Daily Only" or somesuch the Email text box would subscribe them via bloglet (and the URL field dropped).  Otherwise the URL and E-Mail text box would be passed to the MT notifications system for By article updates.

Here is the current code for both forms.  I hope this is possible as it would solve a big Kludge dor subscriptions until MT comes out with a better notification system.

MT Notification Code
CODE
<form method="post" action="<$MTCGIPath$>mt-add-notify.cgi">
<input type="hidden" name="blog_id" value="<$MTBlogID$>" />
<input type="hidden" name="_redirect" value="<$MTBlogURL$>" />
<div style="font-weight:bold;">E-Mail:</div>
<input name="email" size="20" class="search" /><br />
<div style="font-weight:bold;">URL (optional):</div>
<input name="url" size="20" class="search" /><br />
<input type="submit" value="add" />
</form>


And Bloglet:
CODE
<form method="post" action="http://www.bloglet.com/subscribe.asp">
<input type="hidden" name="ID" value="XXXX" />
Subscribe to <b>Sea 'Doc'.net</b>!<br /><br />
<input type="text" name="email" value="" size="20" maxlength="100" />
<input type="submit" name="Submit" value="subscribe" /><br />
<a href="http://www.bloglet.com/">by Bloglet</a>
</form>
almuhajabah
This would be a good idea. Right now, I have the two submission forms one right below the other. Combining them into a single form would be more elegant and perhaps easier to understand.
girlie
This is what I came up with using java script:

CODE
<script language="Javascript">
function bloglet(form)
{  
document.myform.action="http://www.bloglet.com/subscribe.asp"
document.myform.submit()
}  
function notify(form)
{  
document.myform.action="<MTCGIPath>mt-add-notify.cgi"
document.myform.submit()
}  
 
</script>


<form name="myform" method="post" action="<MTCGIPath>mt-add-notify.cgi">
<input type="hidden" name="blog_id" value="<MTBlogID>">
<input type="hidden" name="_redirect" value="<MTBlogURL>">
<input type="hidden" name="ID" value="XXXX">
email: <input class="forms" value="" name="email" size="20" maxlength="100" /><br/><br/>
url: <input class="forms" value="" name="url" size="23" /><br/>
(optional)<br/><br/>
<input class="buttons" type="submit" value=" bloglet " onClick="bloglet()"; />
<input class="buttons" type="submit" value=" notify " onClick="notify()"; />
</form>


It seemed to work, but I wonder if it's possible to do without Javascript, since that seems preferable to me. But you need a way to get multiple actions in the form, so....
girlie
Oh, and I'm not sure what happens if someone enters a URL on the Bloglet option. Presumably it's just ignored??
girlie
Oh, and I'm using submit buttons rather than a checkbox or radio button. I'll work on that.  :)
medic119
Seems I stumbled onto something here..
I see if I can add my menial programming experience here.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.