Skip navigation.

Harold's Home

   Home
  
XML version of this site

PHP Scripts

Index
CLI fun
Mail on 404
HB-NS (NewsScript)

Downloads

Applescripts
APOD to Desktop
Dreamweaver Extensions

Stuff

Writings
Other stuff
Central Grinder

OOOk Default:

VJ stuff
VJ Tools
Bananas
Strippers
Sample Movies

News

Adding forms in MCMS
Gaaaaaaaaaah!!!!!!


I'm working in MCMS and trying to add a form to pages I create. Unfortunately I cannot add a real form as the entire page already is one and nested forms are not allowed in HTML. Normally when things are not allowed you can sneak around and do them anyway with a reasonable expectation of getting them to work as browsers are very tolerant of errors and whatnot.
Not so in this case!

I did manage to find a way to work around it though by just inserting the needed form elements without <form> tags and then using a very small bit of custom javascript. This custom script will rewrite the normal action url of the resident form and overwrite a few of the default values with nothing. This could probably be handled a bit better but I'm unsure of whether javascript supports a function like PHP's unset().
<script>
function doForm()
{
theform=document.Form1;
theform.action="http://atoz.ebsco.com/home.asp";
//strip surplus unwanted values that reside by default in MCMS pages
theform.unwanted.value = "";
theform.unwanted2.value = "";
theform.submit();
}
</script>


And then the search button can have an onClick event as follows:
<input onClick="javascript:doForm();" type="submit" value="Search" name="cmdSearchSubmit" />

Unfortunately I cannot add javascript to my pages as they're deleted right away, so I'm stuck in limbo with nothing to show for my efforts accept an angry post.


Update: good friend Jurjan (of Virtual Pet Rock fame) emailed me to suggest that if Microsoft's crappy management system deletes script tags I might be able to put the javascript into the onclick handler of the submit button. This works like a charm! So instead of calling a function I just put the entire javascript there like so:
<input onclick="javascript:theform=document.Form1; theform.method='get'; theform.action='http://atoz.ebsco.com.www.dbproxy.hu.nl/titles.asp?id=7713&linktype=' +theform.linktype.value+ '&SF='+theform.SF.value+ '&ST=' +theform.ST.value+'&WW=' +theform.WW.value; theform.__EVENTARGUMENT.value = ''; theform.__VIEWSTATE.value = ''; theform.__EVENTTARGET.value = '';theform.submit();" type="submit" value="Zoek" name="cmdSearchSubmit" />

It's may be a bit clunky but it works.

Show all items | Read all items

About, copyright, privacy and accessibility | Mail