Developer forum

Forum » Templates » Generated key in Form.Start - onsubmit

Generated key in Form.Start - onsubmit

Claus Kølbæk
Reply

Hey

When you under management center - > Web and HTTP -> Security enable "Activate antispam funcitonality" the Form.Start in forms add a key in the onsubmit function - which I assume is used for something :) - Is there an easy way to get this key?

Currently this is doing the trick:

System.Text.RegularExpressions.Regex.Match(GetString("Form.Start"), "<form.+?onsubmit=[\"](.+?)[\"].*?>", System.Text.RegularExpressions.RegexOptions.IgnoreCase).Groups[1].Value;

But I would prefer to just be able to access anything generated in all the .Start and .End tags without having to regrex it out - that ofc. goes for anywere you have start/end as we often prefer to make them ourselves.

So is it already possible? If so - how?

If not - please move this to feature request :)


Replies

 
Nicolai Høeg Pedersen
Reply

Hi Claus

I think you must be in forms for editors. You can use the tag "Form.OnSubmit" which will give you the js from the onsubmit attribute. Use "Form.SystemFields" to get the hidden fields exposing all the values and "Form.SpamScript" to get the script being called from the onsubmit event.

BR Nicolai

 
Claus Kølbæk
Reply

Hi Nicolai

Thank you for the quick answer :)

But no I am not in forms for editors, but if it has the functionality I am looking for then I will look into if its possible to use it instead.

I am using the slightly older module: "Forms (For datalists)"

and a tag like Form.OnSubmit would work well enough, but it does not seem like that is available on Forms (For datalists)

From TemplateTags I have the following:

 

Form.Start <form method="post" id="FormSave4" name="FormSave4" enctype="multipart/form-data" action="/Admin/Public/404.aspx" onsubmit="s=function(e){e.elements['FormCH1_h'].value='c47cb51c16f7ea8da14cfd3753fe176c';e.elements['_sys_to_email'].value='';e.setAttribute('action', '***WebSitePage***');return true};return s(this)">

and it is the value in the onsubmit I am after.

It sadly has no Form.OnSubmit :)

 

 
Nicolai Høeg Pedersen
Reply

Hi Claus

That module does not have those tags unfortunately...

BR Nicolai

 

You must be logged in to post in the forum