Skip to main content
adamaas
Known Participant
January 24, 2012
Question

Is there some way to detect a form tag in coldfusion ?

  • January 24, 2012
  • 1 reply
  • 766 views

Hello,

am actually developing a marker on a site. The marker consists of a tooltip which is in javascript and css. The marker actually will be called on a page by it tag name which I've created. For exemple, the page of the marker is named marker.cfm, when i'll call the marker in another page, this would be like this <sitename:marker></sitename:marker>.

I want to use this marker in a form.

My question is : "Is there some way to detect a form tag in coldfusion ?"

Somebody could help me or give me a tip so that I can proceed further ?

Thanks in advance.

    This topic has been closed for replies.

    1 reply

    BKBK
    Community Expert
    Community Expert
    January 24, 2012

    Do you mean a way to detect a form on the current page, or on the page from which we've arrived (the referrer page)?

    adamaas
    adamaasAuthor
    Known Participant
    January 24, 2012

    On the current page.

    BKBK
    Community Expert
    Community Expert
    January 25, 2012

    <form>

        <input name="txt1" type="text">

        <input name="txt2" type="text">

        <input name="txt3" type="text">

    </form>

    <!--- Read the CFM file of the current page --->

    <cffile action="read" file="#expandPath('#cgi.script_name#')#" variable="currentCfmPage">

    <!--- Use regular expressions to find form tags on the page --->

    <!--- You could also add a similar line of code to find the cfform tag. --->

    <cfset findFormtag = REFindNoCase("<form>(.|\s)*</form>",currentCfmPage)>

    <cfif findFormtag GTE 1>

        <p>There is a form tag on the page</p>

    </cfif>