<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Xlinesoft Blog</title>
	
	<link>http://xlinesoft.com/blog</link>
	<description>Building the best code generator</description>
	<lastBuildDate>Tue, 21 May 2013 20:43:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/XlinesoftBlog" /><feedburner:info uri="xlinesoftblog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:browserFriendly></feedburner:browserFriendly><item>
		<title>Validation in PHPRunner and ASPRunnerPro applications</title>
		<link>http://xlinesoft.com/blog/2013/05/21/validation-in-phprunner-and-asprunnerpro-applications/</link>
		<comments>http://xlinesoft.com/blog/2013/05/21/validation-in-phprunner-and-asprunnerpro-applications/#comments</comments>
		<pubDate>Tue, 21 May 2013 20:30:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP Code Generator]]></category>
		<category><![CDATA[PHP Form Generator]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://xlinesoft.com/blog/?p=787</guid>
		<description><![CDATA[<p>Data validation is very important in web applications. You do not want your users to enter incorrect data. Our web application builders can help you with this.</p> <h2>Client-side validation</h2> <p>Client side validation (Javascript based) provides instant feedback to the user making it a good usability choice.</p> <h3>Built-in validation types</h3> <p>This validation will work if <span style="color:#777"> . . . &#8594; Read More: <a href="http://xlinesoft.com/blog/2013/05/21/validation-in-phprunner-and-asprunnerpro-applications/">Validation in PHPRunner and ASPRunnerPro applications</a></span>]]></description>
			<content:encoded><![CDATA[<p>Data validation is very important in web applications. You do not want your users to enter incorrect data. Our web application builders can help you with this.</p>
<h2>Client-side validation</h2>
<p>Client side validation (Javascript based) provides instant feedback to the user making it a good usability choice.</p>
<h3>Built-in validation types</h3>
<p>This validation will work if you need to make sure that all required fields are populated or validate a relatively simple data format like US Social Security Number.  More info</p>
<h3>Regular expressions</h3>
<p>Regular expressions are both powerful and tough to master. Luckily there is a number of examples and tutorials on the web. Besides that PHPRunner and ASPRunnerPro come with built-in Regular expressions testing tool.  Regular expressions to validate data formats like IP addresses or Tax IDs in some countries.  More info</p>
<h3>Custom validation plugins</h3>
<p>When you need something more complicated i.e. algorithm based credit card number validation - custom validation plugins come to rescue.  More info</p>
<h3>Input mask</h3>
<p>Sometimes no validation is the bet option. Turn on masked edit option in PHPRunner or ASPRunnerPro to prevent users from entering anything but correct data format. Works the best with fixed length data like phone numbers or social security numbers.  More info</p>
<h3>Edit plugins</h3>
<p>Many custom Edit plugins, especially those that target numeric data input, come with built-in validation. Examples are Slider, Spinner and Knob plugins. All of them allow you to setup the range of input data.  How to create your own Edit plugin</p>
<h2>Server-side validation</h2>
<p>You may have noticed that none of client side examples perform data validation against database. Server side validation overcomes this limitation. You can check entered data for duplicates or simply check if you have enough widgets in stock before letting customer to place the order.  In PHPRunner/ASPRunnerPro software server side validation is typically implemented as BeforeAdd/BeforeEdit events.  Here is some sample code     More info  The only drawback of server is based validation is that user experience suffers. Page needs to be reloaded and in some cases user needs to scroll the page in order to find the field that didn't pass the validation.</p>
<h2>Combined validation</h2>
<p>Combined validation brings the best of two worlds together. You can validate data against your database without reloading the page providing instant feedback to the user.  To see a real life example proceed to Xlinesoft Marketplace, add any product to the cart and click Checkout. On 'Create an account' page enter any email address that is already in the system i.e kornilov(at)gmail.com and move focus to the next field.</p>
<p>You will see  "Email address already exists. <a>Login here" message once focus leaves the email field. Now user can enter another email address or sign in if registered already. </a></p>
<p>Note that if you don't change the email address and still submit the form you will get similar message that is now coming from BeforeAdd event.  It's always recommended to use both  types of validation together. This prevents the situation when user ignores the warning and submits the form anyway.</p>
<p>Here is how this sort of functionality can be added to your project.</p>
<h4>1.  Modify page in Visual Editor adding a DIV tag where our message will be displayed.</h4>
<pre><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;TD class=&quot;runner-cc alt runner-fixedcell&quot;&gt;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;DIV class=&quot;fieldcontrol_email {$fielddispclass_email}&quot;&gt;{$email_editcontrol}&lt;/DIV&gt;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;DIV id=email-message&gt;&lt;/DIV&gt;&lt;/TD&gt;</div></li></ol></pre>
<h4>2. Javascript OnLoad event. This code sample assumes that field name is <strong>email</strong></h4>
<pre class="javascript"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> message = <span style="color: #3366CC;">'Email address already exists.'</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> ctrlEmail = Runner.<span style="color: #006600;">getControl</span><span style="color: #66cc66;">&#40;</span>pageid, <span style="color: #3366CC;">'email'</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ctrlEmail.<span style="color: #006600;">on</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'blur'</span>, <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>e<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">getValue</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>==<span style="color: #3366CC;">''</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#email-message'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">css</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'display'</span>,<span style="color: #3366CC;">'none'</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	$.<span style="color: #006600;">get</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;check_email.php&quot;</span>, <span style="color: #66cc66;">&#123;</span> email: <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">getValue</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">done</span><span style="color: #66cc66;">&#40;</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>data<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>data==<span style="color: #3366CC;">'exists'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>message!=<span style="color: #3366CC;">''</span><span style="color: #66cc66;">&#41;</span> $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#email-message'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">html</span><span style="color: #66cc66;">&#40;</span>message<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#email-message'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">css</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'display'</span>,<span style="color: #3366CC;">'block'</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#email-message'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">css</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'display'</span>,<span style="color: #3366CC;">'none'</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div></li></ol></pre>
<p>This code makes a call to <strong>check_email.php</strong> file via jQuery's <a href="http://api.jquery.com/jQuery.get/">get()</a> function. If check_email.php file returns "exists" we display the message and make DIV visible. </p>
<p><strong>Note:</strong> in ASPRunnerPro replace <em>check_email.php</em> with <em>check_email.asp</em></p>
<p>3. check_email.php (.asp) code.</p>
<p><em>check_email.php</em> file needs to be added to <em>source</em> subdirectory under project directory. Once you build the project it will be copied right to the output directory. Here is what we need to put into check_email.php file:</p>
<pre class="php"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">&lt;?php</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">include</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;include/dbcommon.php&quot;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$rs</span> = CustomQuery<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;select email from LoginTable where email = '&quot;</span> .</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    db_addslashes<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_GET</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'email'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span> . <span style="color: #ff0000;">&quot;'&quot;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>db_fetch_array<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$rs</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&quot;exists&quot;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">else</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&quot;&quot;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">?&gt;</span></div></li></ol></pre>
<p>This code assumes that table name is <em>LoginTable</em> and field name is <em>email</em>.<br />
ASP version of the same code (check_email.asp):</p>
<pre class="asp"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff; font-weight: bold;">&lt;%</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff; font-weight: bold;">%&gt;</span></div></li></ol></pre>
<p><strong>Note:</strong> since we process data entered by end user manually we need to take care of SQL injections attacks. Function <em>db_addslashes()</em> does all the job for us screening "bad" characters. </p>
<h4>4. BeforeAdd code</h4>
<pre class="php"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$rs</span> = CustomQuery<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;select email from LoginTable where email = '&quot;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">      . db_addslashes<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$values</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;email&quot;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span> . <span style="color: #ff0000;">&quot;'&quot;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>db_fetch_array<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$rs</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #0000ff;">$message</span> = <span style="color: #ff0000;">&quot;Email address &quot;</span>.<span style="color: #0000ff;">$values</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;email&quot;</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">&quot;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000;">                 already exists. &lt;br&gt;Sign in or choose another email address.&quot;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">false</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$message</span>=<span style="color: #ff0000;">&quot;&quot;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">true</span>;</div></li></ol></pre>
<p>This code does the same job. We just want to protect ourself from the situation when user ignores the warning and submits the form anyway. </p>
]]></content:encoded>
			<wfw:commentRss>http://xlinesoft.com/blog/2013/05/21/validation-in-phprunner-and-asprunnerpro-applications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Displaying a page in a popup window</title>
		<link>http://xlinesoft.com/blog/2013/04/25/displaying-a-page-in-a-popup-window/</link>
		<comments>http://xlinesoft.com/blog/2013/04/25/displaying-a-page-in-a-popup-window/#comments</comments>
		<pubDate>Thu, 25 Apr 2013 23:02:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://xlinesoft.com/blog/?p=722</guid>
		<description><![CDATA[<p>If you take a look at� Xlinesoft Marketplace you will find that many functions like login/register/rate are implemented in popup windows. This approach greatly improves usability, users do not need to leave the page they are on in order to logon. This article shows how to add such functionality to your PHPRunner or ASPRunner <span style="color:#777"> . . . &#8594; Read More: <a href="http://xlinesoft.com/blog/2013/04/25/displaying-a-page-in-a-popup-window/">Displaying a page in a popup window</a></span>]]></description>
			<content:encoded><![CDATA[<p>If you take a look at <a href="https://xlinesoft.com/marketplace">Xlinesoft Marketplace</a> you will find that many functions like login/register/rate are implemented in popup windows. This approach greatly improves usability, users do not need to leave the page they are on in order to logon. This article shows how to add such functionality to your PHPRunner or ASPRunner application.</p>
<p><img class="aligncenter size-full wp-image-740" title="login_in_popup" src="http://xlinesoft.com/blog/wp-content/uploads/2013/04/login_in_popup1.png" alt="" width="655" height="413" /></p>
<p><span id="more-722"></span></p>
<h3>1. Creating include file with Javascript functions</h3>
<p>We use YUI 3 library to display modal popup windows. Since there are going to be several Javascript functions I recommend to create a myscripts.js file and put all those functions there. This file needs to be created in <em>source</em> subdirectory under your project directory i.e.<br />
<em>C:\Users\&lt;Username&gt;\Documents\PHPRunnerProjects\Project1\source\myscripts.js</em></p>
<p><em>displayPopup()</em> is the function that actually creates the popup window a loads another page there. We will create a few wrappers for this functions, one for each specific action like login or register.</p>
<pre class="javascript"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">function</span> displayPopup<span style="color: #66cc66;">&#40;</span>params<span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #003366; font-weight: bold;">var</span> pageid=<span style="color: #CC0000;">1</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #003366; font-weight: bold;">var</span> pageObj = Runner.<span style="color: #006600;">pages</span>.<span style="color: #006600;">PageManager</span>.<span style="color: #006600;">getById</span><span style="color: #66cc66;">&#40;</span>pageid<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	args = <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		bodyContent: <span style="color: #3366CC;">&quot;&lt;iframe frameborder='0' id='popupIframe&quot;</span> + pageid + <span style="color: #3366CC;">&quot;' style='width: 100%; height: 100%; border: 0;'&gt;&lt;/iframe&gt;&quot;</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		footerContent: <span style="color: #3366CC;">&quot;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&quot;</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		headerContent: params.<span style="color: #006600;">headerContent</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		centered: <span style="color: #003366; font-weight: bold;">true</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		render: <span style="color: #003366; font-weight: bold;">true</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		width: params.<span style="color: #006600;">width</span> ? params.<span style="color: #006600;">width</span> : <span style="color: #CC0000;">450</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		height: params.<span style="color: #006600;">height</span> ? params.<span style="color: #006600;">height</span> : <span style="color: #CC0000;">315</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #66cc66;">&#125;</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	afterCreateHandler = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>win<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #003366; font-weight: bold;">var</span> bodyNode = $<span style="color: #66cc66;">&#40;</span>win.<span style="color: #006600;">bodyNode</span>.<span style="color: #006600;">getDOMNode</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		iframeNode = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;iframe#popupIframe&quot;</span> + pageid, bodyNode<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		iframeNode.<span style="color: #006600;">load</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>Runner.<span style="color: #006600;">isChrome</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">				bodyNode.<span style="color: #006600;">addClass</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;noScrollBar&quot;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		win.<span style="color: #006600;">show</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;	</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">attr</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;src&quot;</span>, params.<span style="color: #006600;">url</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #66cc66;">&#125;</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	afterCloseHandler = params.<span style="color: #006600;">afterClose</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>Runner.<span style="color: #006600;">isChrome</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;&lt; style type='text/css'&gt; .yui3-widget-bd::-webkit-scrollbar {display:none;} &lt; /style&gt;&quot;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">appendTo</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;head&quot;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Runner.<span style="color: #006600;">pages</span>.<span style="color: #006600;">PageManager</span>.<span style="color: #006600;">createFlyWin</span>.<span style="color: #006600;">call</span><span style="color: #66cc66;">&#40;</span>pageObj, args, <span style="color: #003366; font-weight: bold;">true</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">afterCreateHandler, afterCloseHandler<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">function</span> login<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">params = <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		url: <span style="color: #3366CC;">'login.php'</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		afterClose: <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>win<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			win.<span style="color: #006600;">destroy</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #66cc66;">&#125;</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		headerContent: <span style="color: #3366CC;">'Login'</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">displayPopup<span style="color: #66cc66;">&#40;</span>params<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li></ol></pre>
<h3>2. Plugging it in</h3>
<p>Including this Javascript file. In Visual Editor add the following line somewhere in the beginning of the file in HTML mode:</p>
<pre class="javascript"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;script src=<span style="color: #3366CC;">&quot;myscripts.js&quot;</span> type=<span style="color: #3366CC;">&quot;text/javascript&quot;</span>&gt;&lt;/script&gt;</div></li></ol></pre>
<p>If you plan to use this functionality on multiple pages it makes sense to add this code snippet to Header file.</p>
<h3>3. Making popup window close automatically</h3>
<p>If you want your window to close automatically after Submit/Login/Save button is clicked you need to add the code that closes the popup. In case of Login page add this code to AfterSuccessfulLogin event, in case of Add page add this code to AfterAdd event:</p>
<p>PHP</p>
<pre class="php"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$_SESSION</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;user_id&quot;</span><span style="color: #66cc66;">&#93;</span>=<span style="color: #0000ff;">$data</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;id&quot;</span><span style="color: #66cc66;">&#93;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'&lt;script type=&quot;text/javascript&quot; src=&quot;include/loadfirst.js&quot;&gt;&lt;/script&gt;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000;">&lt;script&gt;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000;">$(document).ready(function() {</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000;">$(&quot;.yui3-button-close&quot;, window.parent.document).trigger(&quot;click&quot;);</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000;">$(&quot;.yui3-panel-content&quot;, window.parent.document).remove();</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000;">});</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000;">&lt;/script&gt;'</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/exit"><span style="color: #000066;">exit</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li></ol></pre>
<p>ASP</p>
<pre class="asp"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #990099; font-weight: bold;">Session</span><span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #cc0000;">&quot;user_id&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span>=data<span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #cc0000;">&quot;id&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #990099; font-weight: bold;">Response</span>.<span style="color: #330066;">Write</span> <span style="color: #cc0000;">&quot;&lt;script type='text/javascript' src='include/loadfirst.js'&gt;&lt;/script&gt;&quot;</span> &amp; _</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">&quot;&lt;script&gt;&quot;</span> &amp; _</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">&quot;$(document).ready(function() {&quot;</span> &amp; _</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">&quot;$('.yui3-button-close', window.parent.document).trigger('click');&quot;</span> &amp; _</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">&quot;$('.yui3-panel-content', window.parent.document).remove();&quot;</span> &amp; _</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">&quot;});&quot;</span> &amp; _</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">&quot;&lt;/script&gt;&quot;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #990099; font-weight: bold;">Response</span>.<span style="color: #990099; font-weight: bold;">End</span></div></li></ol></pre>
<h3>4. Displaying the popup</h3>
<p>Now anywhere on the page we can add the following HTML code:</p>
<pre class="javascript"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;span id=<span style="color: #3366CC;">'username'</span>&gt;&lt;a href=<span style="color: #3366CC;">'#'</span> onclick=<span style="color: #3366CC;">'login();'</span>&gt;Sign in&lt;<span style="color: #0066FF;">/a&gt;&lt;/</span>span&gt;</div></li></ol></pre>
<p>Note that 'Sign in' link is wrapped by span with id <em>'username'</em>. We are going to need this span later in section #5.</p>
<p>You can build and run your project now. User clicks 'Sign in' link, login page is open in the popup and closes itself after successful login.</p>
<p>While this functionality is certainly useful real life applications require more smooth user experience. For instance, after successful login we want to replace 'Sign in' link with logged user name linking to personal details page.</p>
<h3>5. Making it useful</h3>
<p>Now it's time to add more code to afterClose() function. In this function we will perform an AJAX call to <em>getusername.php</em> file and if we have a response we are going to replace the current content of <em>'username'</em> span with what <em>getusername.php</em> file returns.</p>
<pre class="javascript"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">function</span> login<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">params = <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		url: <span style="color: #3366CC;">'login.php'</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		afterClose: <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>win<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			win.<span style="color: #006600;">destroy</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			$.<span style="color: #006600;">get</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;getusername.php&quot;</span>, <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>data<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>data<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">				$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#username'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">html</span><span style="color: #66cc66;">&#40;</span>data<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #66cc66;">&#125;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">			<span style="color: #66cc66;">&#125;</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		headerContent: <span style="color: #3366CC;">'Login'</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">displayPopup<span style="color: #66cc66;">&#40;</span>params<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li></ol></pre>
<p>If you are familiar with jQuery you will feel right at home. For others I recommend to check what <a href="http://api.jquery.com/get/">get()</a> and <a href="http://api.jquery.com/html/">html()</a> functions do.</p>
<p>Now lets see what <em>getusername.php</em> file does. This file needs to be placed to the same <em>source</em> subdirectory.</p>
<p>PHP (getusername.php)</p>
<pre class="php"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">&lt;?php</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/session_start"><span style="color: #000066;">session_start</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_SESSION</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;UserName&quot;</span><span style="color: #66cc66;">&#93;</span> &amp;&amp; <span style="color: #0000ff;">$_SESSION</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;UserName&quot;</span><span style="color: #66cc66;">&#93;</span>!=<span style="color: #ff0000;">&quot;Guest&quot;</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&quot;&lt;a href='UserProfile_edit.php?editid1=&quot;</span>.<span style="color: #0000ff;">$_SESSION</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;user_id&quot;</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">&quot;'&gt;&quot;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">        . <span style="color: #0000ff;">$_SESSION</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;UserName&quot;</span><span style="color: #66cc66;">&#93;</span> . <span style="color: #ff0000;">&quot;&quot;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">else</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&quot;&quot;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">?&gt;</span></div></li></ol></pre>
<p>Note that this code uses $_SESSION["user_id"] variable we have set previously in AfterSuccessfulLogin event. We need this variable to build a proper URL of user profile page. In our example the name of the login table is UserProfile. You will need to change it accordingly in your project.</p>
<p>ASP (getusername.asp)</p>
<pre class="asp"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff; font-weight: bold;">&lt;%</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #990099; font-weight: bold;">if</span> <span style="color: #990099; font-weight: bold;">SESSION</span><span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #cc0000;">&quot;UserName&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span> <span style="color: #0000ff; font-weight: bold;">and</span> <span style="color: #990099; font-weight: bold;">SESSION</span><span style="color: #006600; font-weight:bold">&#91;</span><span style="color: #cc0000;">&quot;UserName&quot;</span><span style="color: #006600; font-weight:bold">&#93;</span>&gt;&lt;<span style="color: #cc0000;">&quot;Guest&quot;</span> <span style="color: #990099; font-weight: bold;">then</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    <span style="color: #990099; font-weight: bold;">Response</span>.<span style="color: #330066;">Write</span> <span style="color: #cc0000;">&quot;&lt;a href='UserProfile_edit.asp?editid1=&quot;</span> &amp; <span style="color: #990099; font-weight: bold;">SESSION</span><span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #cc0000;">&quot;user_id&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span> &amp; _</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">          <span style="color: #cc0000;">&quot;'&gt;&quot;</span> &amp; <span style="color: #990099; font-weight: bold;">SESSION</span><span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #cc0000;">&quot;UserName&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span> &amp; <span style="color: #cc0000;">&quot;&quot;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #990099; font-weight: bold;">else</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    <span style="color: #990099; font-weight: bold;">Response</span>.<span style="color: #330066;">Write</span> <span style="color: #cc0000;">&quot;&quot;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #990099; font-weight: bold;">end</span> <span style="color: #990099; font-weight: bold;">if</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff; font-weight: bold;">%&gt;</span></div></li></ol></pre>
<p>You can see it all in action. Proceed to <a href="https://xlinesoft.com/marketplace/products_view.php?editid1=6">Slider plugin</a> page and click 'Sign in' link at the top. Once you are logged in you can see 'Sign in' being replaced with your user name. 'Login' and 'Register' links under <strong>Reviews</strong> will be replace with '<a>Rate this product' link. If you made it this far you can add functionality like this to your applications as well. </a></p>
<p>Feel free to to post your questions or comments below.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://xlinesoft.com/blog/2013/04/25/displaying-a-page-in-a-popup-window/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>ASPRunner.NET 6.0 preview</title>
		<link>http://xlinesoft.com/blog/2013/02/13/asprunner-net-6-0-preview/</link>
		<comments>http://xlinesoft.com/blog/2013/02/13/asprunner-net-6-0-preview/#comments</comments>
		<pubDate>Wed, 13 Feb 2013 16:43:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ASP.NET]]></category>

		<guid isPermaLink="false">http://xlinesoft.com/blog/?p=708</guid>
		<description><![CDATA[<p>We are glad to announce a first public preview of ASPRunner.NET 6.0. This is a not a stable release, feel free to use it for evaluation purposes. We expect final version to be available in a few weeks.</p> <p>ASPRunner.NET 6.0 is built on the top of MVC3 framework.</p> <p>Download links: http://asprunner.com/files/asprunnernet60-trial-setup.exe http://asprunner.com/files/asprunnernet60-trial-setup.zip</p> <p>Here is <span style="color:#777"> . . . &#8594; Read More: <a href="http://xlinesoft.com/blog/2013/02/13/asprunner-net-6-0-preview/">ASPRunner.NET 6.0 preview</a></span>]]></description>
			<content:encoded><![CDATA[<p>We are glad to announce a first public preview of ASPRunner.NET 6.0. This is a not a stable release, feel free to use it for evaluation purposes. We expect final version to be available in a few weeks.</p>
<p>ASPRunner.NET 6.0 is built on the top of <a href="http://www.asp.net/mvc/mvc3">MVC3 framework</a>.</p>
<p>Download links:<br />
<a href="http://asprunner.com/files/asprunnernet60-trial-setup.exe">http://asprunner.com/files/asprunnernet60-trial-setup.exe</a><br />
<a href="http://asprunner.com/files/asprunnernet60-trial-setup.zip">http://asprunner.com/files/asprunnernet60-trial-setup.zip</a></p>
<p>Here is the list of features that are not implemented yet in this preview. All features below will be available in the final version.</p>
<ul>
<li>Right now SQL Server and MySQL databases are supported. Final version will also support Oracle, MS Access and Postgre.</li>
<li>C# only. VB.NET will be available in final version.</li>
<li>Charts and reports are not supported yet</li>
<li>View/Edit plugins not available yet</li>
<li>Export/Import pages</li>
<li>Events</li>
<li>View as Audio/Video</li>
<li>Active Directory support</li>
<li>Data Encryption</li>
<li>Facebook login</li>
<li>Templates like Jobs, Cars, Vacations etc</li>
<li>Mobile template</li>
</ul>
<p>Here are features that most likely won't make it in ASPRunner.NET 6.0. They will be added in next release.</p>
<ul>
<li>Export to PDF</li>
<li>Export/Import to Excel 2007</li>
<li>Web reports</li>
<li>Templates pack: Shopping Cart, Members, Calendar</li>
</ul>
<p>Let us know what you think of this update. Bug reports to be sent via our <a href="http://xlinesoft.com/dss/support.asp">helpdesk</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://xlinesoft.com/blog/2013/02/13/asprunner-net-6-0-preview/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>How to create your own Edit control plugin</title>
		<link>http://xlinesoft.com/blog/2012/09/07/how-to-create-your-own-edit-control-plugin/</link>
		<comments>http://xlinesoft.com/blog/2012/09/07/how-to-create-your-own-edit-control-plugin/#comments</comments>
		<pubDate>Fri, 07 Sep 2012 22:46:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP Code Generator]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://xlinesoft.com/blog/?p=640</guid>
		<description><![CDATA[<p>PHPRunner 6.2 and ASPRunnerPro 7.2 add an exciting new feature - custom edit controls. You are longer limited by stock Edit controls that come with the software. And the best of all, creating new Edit controls is not complicated and we'll show how this can be done.</p> <p>We will show you how to create <span style="color:#777"> . . . &#8594; Read More: <a href="http://xlinesoft.com/blog/2012/09/07/how-to-create-your-own-edit-control-plugin/">How to create your own Edit control plugin</a></span>]]></description>
			<content:encoded><![CDATA[<p>PHPRunner 6.2 and ASPRunnerPro 7.2 add an exciting new feature - custom edit controls. You are longer limited by stock Edit controls that come with the software. And the best of all, creating new Edit controls is not complicated and we'll show how this can be done.</p>
<p>We will show you how to create ColorPicker and SignaturePad plugins. Before we proceed I recommend to check the following <a href="http://demo.asprunner.net/volinrok_yahoo_com/ColorPickerTest/carsbcolor_add.php">live demo</a> that showcases both edit controls plugins. SignaturePad control works on mobile devices as well. </p>
<p><a href="http://demo.asprunner.net/volinrok_yahoo_com/ColorPickerTest/carsbcolor_add.php"><br />
<img class="size-full wp-image-649" title="signature" src="http://xlinesoft.com/blog/wp-content/uploads/2012/09/signature.png" alt="" width="534" height="275" /></a></p>
<p><span id="more-640"></span></p>
<p><a href="http://demo.asprunner.net/volinrok_yahoo_com/ColorPickerTest/carsbcolor_add.php"><br />
<img src="http://xlinesoft.com/blog/wp-content/uploads/2012/09/qrcode.8619433.png" alt="" title="qrcode.8619433" width="150" height="150" class="size-full wp-image-683" /></a></p>
<h2>ColorPicker control</h2>
<p>Lets say we want to add a color picker control that allows users select color the same way they do in Adobe Photoshop. Since our software comes with jQuery bundled we'll be searching web for "jQuery colorpicker". This search returns a number of results and the one we'll be using is <a href="http://labs.abeautifulsite.net/jquery-miniColors/">miniColors</a>. It looks nice and easy to integrate. Sources can be find at <a href="https://github.com/claviska/jquery-miniColors">Github</a>.</p>
<ul>
<li>create a new folder under <em>&lt;Documents&gt;\PHPRunnerPlugins\edit</em> named ColorPicker
<li>copy files <em>EditMyField.js</em> and <em>EditMyField.php</em> from 'MyField' folder to 'ColorPicker' folder
<li>rename those files to EditColorPicker.js and EditColorPicker.php respectively
<li>if you plugin needs extra files copy them to ColorPicker folder keeping folders structure
<li>open EditColorPicker.js in any text editor and replace all occurences of 'EditMyField' with 'EditColorPicker'. Do the same with EditColorPicker.php file.
<li>use addJSFiles() function in ColorPicker.php to add refeences to external Javascript files:
</ul>
<p>PHP</p>
<pre class="php"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">pageObject</span>-&gt;<span style="color: #006600;">AddJSFile</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;jquery.miniColors.min.js&quot;</span><span style="color: #66cc66;">&#41;</span>;</div></li></ol></pre>
<p>ASP</p>
<pre class="asp"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">this.<span style="color: #9900cc;">pageObject</span>.<span style="color: #9900cc;">AddJSFile_p1</span> <span style="color: #cc0000;">&quot;jquery.miniColors.min.js&quot;</span></div></li></ol></pre>
<ul>
<li> use addCSSFiles() function to add CSS files</ul>
</ul>
<p>PHP</p>
<pre class="php"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">pageObject</span>-&gt;<span style="color: #006600;">AddCSSFile</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;jquery.miniColors.css&quot;</span><span style="color: #66cc66;">&#41;</span>;</div></li></ol></pre>
<p>ASP</p>
<pre class="asp"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">this.<span style="color: #9900cc;">pageObject</span>.<span style="color: #9900cc;">AddCSSFile_p1</span> <span style="color: #cc0000;">&quot;jquery.miniColors.css&quot;</span></div></li></ol></pre>
<p>In EditColorPicker.php file find buildUserControl() function. This is were you build HTML code for your control. If you leave predefined code as is it will display a simple text edit box. We only going add a minor change telling colorpicker control to use black color theme:</p>
<pre><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">class=&quot;black&quot;</div></li></ol></pre>
<p>Lets see how we can turn this edit box into a colorpicker control. According to <a href="https://github.com/claviska/jquery-miniColors/blob/master/readme.md">colorpicker instructions</a> we need to call miniColors Javascript referencing edit box. We'll do so adding the following code to constructor function:</p>
<pre class="javascript"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;#&quot;</span>+<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">valContId</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">miniColors</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">letterCase: <span style="color: #3366CC;">'uppercase'</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div></li></ol></pre>
<p>letterCase option tells control to convert color values entered manually to upper case. this.valContId is the id of the control.</p>
<p>This is it, our control is ready. You can now launch PHPRunner, select ColorPicker as 'Edit as' type for any text field and enjoy your color picker on Add/Edit pages.</p>
<p>You may consider some additional enhancements.</p>
<p>1. It would be nice if instead of hex color value we can show some visual representation of selected color on List/View pages. We'll do so choosing 'View as' type 'Custom' and putting the following code there:</p>
<p>PHP</p>
<pre class="php"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$value</span>=<span style="color: #ff0000;">&quot;&lt;span style='padding: 5px; background: &quot;</span>.<span style="color: #0000ff;">$value</span>.<span style="color: #ff0000;">&quot;'&gt;&quot;</span>.<span style="color: #0000ff;">$value</span>.<span style="color: #ff0000;">&quot;&lt;/span&gt;&quot;</span>;</div></li></ol></pre>
<p>ASP</p>
<pre class="asp"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">strValue=<span style="color: #cc0000;">&quot;&lt;span style='padding: 5px; background: &quot;</span> &amp; strValue &amp; <span style="color: #cc0000;">&quot;'&gt;&quot;</span> &amp; strValue &amp; <span style="color: #cc0000;">&quot;&lt;/span&gt;&quot;</span></div></li></ol></pre>
<p>2. By default PHPRunner set focus to the first edit control when Add or Edit page is loaded. This is not a desired behaviour for colorpciker control as we do not want to see colorpicker popup window to open every time page is loaded. To prevent this from happening we'll implement setFocus function. Our job is to simply return false every time.</p>
<p>You you need to change control behaviour check all functions and events in source\include\common\runnerJS\Control.js file.</p>
<h2>SignaturePad</h2>
<p>The <b>SignaturePad</b> plugin allows to a add signature pad to your forms. SignaturePad works with both mouse and touch devices. We will be using <a href="http://thomasjbradley.ca/lab/signature-pad/">SignaturePad</a> jQuery plugin that comes with excellent documentation and examples.</p>
<p>The basic setup is the same: create new folder for SignaturePad plugin, copy and rename files, add files that plugin needs to plugin directory. This plugin is a bit more complicated and takes a few extra steps to integrate.</p>
<h3>1. Build control's HTML code</h3>
<p>Here is how we do this in <em>buildUserControl()</em> function:</p>
<p>PHP</p>
<pre class="php"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000;">&lt;div class=&quot;sigPad&quot; style=&quot;width: '</span>.<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">width</span><span style="color: #cc66cc;">+2</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">'px;&quot;&gt;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000;">&lt;ul class=&quot;sigNav&quot;&gt;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000;">&lt;li class=&quot;clearButton&quot;&gt;&lt;a href=&quot;#clear&quot;&gt;Clear&lt;/a&gt;&lt;/li&gt;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000;">&lt;/ul&gt;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000;">&lt;div class=&quot;sig sigWrapper&quot;&gt;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000;">&lt;div class=&quot;typed&quot;&gt;&lt;/div&gt;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000;">&lt;canvas class=&quot;pad&quot; width=&quot;'</span>.<span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">width</span>.<span style="color: #ff0000;">'&quot; height=&quot;'</span>.<span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">height</span>.<span style="color: #ff0000;">'&quot;&gt;&lt;/canvas&gt;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000;">&lt;input id=&quot;'</span>.<span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">cfield</span>.<span style="color: #ff0000;">'&quot; type=&quot;hidden&quot; '</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">.<span style="color: #ff0000;">'name=&quot;'</span>.<span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">cfield</span>.<span style="color: #ff0000;">'&quot; class=&quot;output&quot;&gt;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000;">&lt;/div&gt;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000;">&lt;/div&gt;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000;">'</span>;</div></li></ol></pre>
<p>ASP</p>
<pre class="asp"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #990099; font-weight: bold;">dim</span> str</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">str = <span style="color: #cc0000;">&quot;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">&lt;div class='sigPad' style='width: &quot;</span> &amp; <span style="color: #990099; font-weight: bold;">CStr</span><span style="color: #006600; font-weight:bold">&#40;</span>this.<span style="color: #9900cc;">settings</span><span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #cc0000;">&quot;width&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span><span style="color: #800000;">+2</span><span style="color: #006600; font-weight:bold">&#41;</span> &amp; <span style="color: #cc0000;">&quot;px;'&gt;&quot;</span> &amp; _</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">&quot;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">&lt;ul class='sigNav'&gt;&quot;</span> &amp; _</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">&quot;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">&lt;li class='clearButton'&gt;&lt;a href='#clear'&gt;Clear&lt;/a&gt;&lt;/li&gt;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">&quot;</span> &amp; _</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">&quot;&lt;/ul&gt;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">&quot;</span> &amp; _</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">&quot;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">&lt;div class='sig sigWrapper'&gt;&quot;</span> &amp; _</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">&quot;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">&lt;div class='typed'&gt;&lt;/div&gt;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">&quot;</span> &amp; _</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">&quot;&lt;canvas class='pad' width='&quot;</span> &amp; this.<span style="color: #9900cc;">settings</span><span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #cc0000;">&quot;width&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span> &amp; <span style="color: #cc0000;">&quot;' height='&quot;</span> &amp; this.<span style="color: #9900cc;">settings</span><span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #cc0000;">&quot;height&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span> &amp; <span style="color: #cc0000;">&quot;'&gt;&lt;/canvas&gt;&quot;</span> &amp; _</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">&quot;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">&lt;input id='&quot;</span> &amp; this.<span style="color: #9900cc;">cfield</span> &amp; <span style="color: #cc0000;">&quot;' type='hidden' &quot;</span> &amp; _</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">&quot;name='&quot;</span> &amp; this.<span style="color: #9900cc;">cfield</span> &amp; <span style="color: #cc0000;">&quot;' class='output'&gt;&quot;</span> &amp; _</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">&quot;&lt;/div&gt;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">&lt;/div&gt;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">&quot;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ResponseWrite str</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li></ol></pre>
<h3>2. Convert signature data to image</h3>
<p>Signature data is recorded in JSON format as a sequence of lines and passed to the web server this way. Now we need to convert JSON data to PNG file and save it in 'files' folder on the web server. Luckily all the hard work was already done and all we need to do is to add a few lines of code to  <em>readWebValue()</em> function:</p>
<p>PHP</p>
<pre class="php"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">webValue</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #808080; font-style: italic;">// save signature to file</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #b1b100;">require_once</span> <span style="color: #ff0000;">'signature-to-image.php'</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #0000ff;">$img</span> = sigJsonToImage<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">webValue</span>, <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">				<span style="color: #ff0000;">'imageSize'</span> =&gt; <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">width</span>, <span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">height</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">				,<span style="color: #ff0000;">'bgColour'</span> =&gt; <span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">bgcolor</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">				<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #0000ff;">$filename</span>= <span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">folder</span>.<span style="color: #ff0000;">&quot;/&quot;</span>.generatePassword<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">15</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">&quot;.png&quot;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	imagepng<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$img</span>, <span style="color: #0000ff;">$filename</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #0000ff;">$filesize</span> = <a href="http://www.php.net/filesize"><span style="color: #000066;">filesize</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$filename</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #808080; font-style: italic;">// prepare image info to be saved in db</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #0000ff;">$result</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;name&quot;</span> =&gt; <span style="color: #0000ff;">$filename</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #ff0000;">&quot;usrName&quot;</span> =&gt; <span style="color: #ff0000;">'signature.png'</span>, <span style="color: #ff0000;">&quot;size&quot;</span> =&gt; <span style="color: #0000ff;">$filesize</span>, <span style="color: #ff0000;">&quot;type&quot;</span> =&gt; <span style="color: #ff0000;">&quot;image/png&quot;</span>,</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #ff0000;">&quot;searchStr&quot;</span> =&gt; <span style="color: #ff0000;">'signature.png'</span>.<span style="color: #ff0000;">&quot;:sStrEnd&quot;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">webValue</span> = my_json_encode<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$result</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #66cc66;">&#125;</span></div></li></ol></pre>
<p>ASP</p>
<pre class="asp"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	this_object.<span style="color: #9900cc;">getPostValueAndType</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #990099; font-weight: bold;">if</span> bValue<span style="color: #006600; font-weight:bold">&#40;</span>FieldSubmitted<span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #006600; font-weight:bold">&#40;</span>CSmartStr<span style="color: #006600; font-weight:bold">&#40;</span>this_object.<span style="color: #9900cc;">goodFieldName</span><span style="color: #006600; font-weight:bold">&#41;</span> &amp; <span style="color: #cc0000;">&quot;_&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span> &amp; CSmartStr<span style="color: #006600; font-weight:bold">&#40;</span>this_object.<span style="color: #9900cc;">id</span><span style="color: #006600; font-weight:bold">&#41;</span><span style="color: #006600; font-weight:bold">&#41;</span><span style="color: #006600; font-weight:bold">&#41;</span> <span style="color: #990099; font-weight: bold;">then</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		doClassAssignment this_object,<span style="color: #cc0000;">&quot;webValue&quot;</span>,prepare_for_db<span style="color: #006600; font-weight:bold">&#40;</span>this_object.<span style="color: #9900cc;">field</span>,this_object.<span style="color: #9900cc;">webValue</span>,this_object.<span style="color: #9900cc;">webType</span>,<span style="color: #cc0000;">&quot;&quot;</span>,<span style="color: #cc0000;">&quot;&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #990099; font-weight: bold;">else</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		this_object.<span style="color: #9900cc;">webValue</span> = <span style="color: #0000ff; font-weight: bold;">false</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #990099; font-weight: bold;">end</span> <span style="color: #990099; font-weight: bold;">if</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #990099; font-weight: bold;">if</span> Left<span style="color: #006600; font-weight:bold">&#40;</span>this_object.<span style="color: #9900cc;">webValue</span>,<span style="color: #330066;">Len</span><span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #cc0000;">&quot;data:image/png;base64,&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span><span style="color: #006600; font-weight:bold">&#41;</span>=<span style="color: #cc0000;">&quot;data:image/png;base64,&quot;</span> <span style="color: #990099; font-weight: bold;">then</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		this_object.<span style="color: #9900cc;">webValue</span> = Mid<span style="color: #006600; font-weight:bold">&#40;</span>this_object.<span style="color: #9900cc;">webValue</span>, <span style="color: #330066;">Len</span><span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #cc0000;">&quot;data:image/png;base64,&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span><span style="color: #800000;">+1</span><span style="color: #006600; font-weight:bold">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #990099; font-weight: bold;">end</span> <span style="color: #990099; font-weight: bold;">if</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	filename = generatePassword<span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #800000;">15</span><span style="color: #006600; font-weight:bold">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #0000ff; font-weight: bold;">var</span> = Base64Decode<span style="color: #006600; font-weight:bold">&#40;</span>this_object.<span style="color: #9900cc;">webValue</span><span style="color: #006600; font-weight:bold">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	runner_save_file CSmartStr<span style="color: #006600; font-weight:bold">&#40;</span>getabspath<span style="color: #006600; font-weight:bold">&#40;</span>this_object.<span style="color: #9900cc;">settings</span><span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #cc0000;">&quot;folder&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span><span style="color: #006600; font-weight:bold">&#41;</span><span style="color: #006600; font-weight:bold">&#41;</span> &amp; <span style="color: #cc0000;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span> &amp; filename &amp; &quot;</span>.<span style="color: #9900cc;">png</span><span style="color: #cc0000;">&quot; , var</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">	set result=CreateDictionary()</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">	set result1 = CreateDictionary()</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">	setArrElement result,&quot;</span>name<span style="color: #cc0000;">&quot;,this_object.settings(&quot;</span>folder<span style="color: #cc0000;">&quot;) &amp; &quot;</span>/<span style="color: #cc0000;">&quot; &amp; filename &amp; &quot;</span>.<span style="color: #9900cc;">png</span><span style="color: #cc0000;">&quot;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">	setArrElement result,&quot;</span>usrName<span style="color: #cc0000;">&quot;,&quot;</span>signature.<span style="color: #9900cc;">png</span><span style="color: #cc0000;">&quot;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">	setArrElement result,&quot;</span>size<span style="color: #cc0000;">&quot;,LenB(var)</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">	setArrElement result,&quot;</span>type<span style="color: #cc0000;">&quot;,&quot;</span>image/png<span style="color: #cc0000;">&quot;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">	setArrElement result,&quot;</span>searchStr<span style="color: #cc0000;">&quot;,&quot;</span>signature.<span style="color: #9900cc;">png</span><span style="color: #cc0000;">&quot; &amp; &quot;</span>:sStrEnd<span style="color: #cc0000;">&quot;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">	set result1(0) = result</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">	this_object.webValue = my_json_encode(result1)</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">	if not (IsFalse(this_object.webValue)) then</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">		setArrElement avalues,this_object.field,this_object.webValue</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;">	end if</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;"</span></div></li></ol></pre>
<p>You can read more info JSON to image conversion <a href="http://thomasjbradley.ca/lab/signature-to-image/">here</a>.</p>
<p>Note the way how file info is stored in the database. Since new version offers multiple files upload we need to be able to store more info there than just file name. Besides the file name itself we also save file size, file type and path to the file in JSON format. Here is how typical file upload field looks in the database:</p>
<pre><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">[{&quot;name&quot;:&quot;files\/h8hsoz5hd23b0ik.jpg&quot;,&quot;usrName&quot;:&quot;Chrysanthemum.jpg&quot;,&quot;size&quot;:879394,&quot;type&quot;:&quot;image\/jpeg&quot;,&quot;searchStr&quot;:&quot;Chrysanthemum.jpg:sStrEnd&quot;},</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">{&quot;name&quot;:&quot;files\/2p85jz854o6fbv8.jpg&quot;,&quot;usrName&quot;:&quot;Desert.jpg&quot;,&quot;size&quot;:845941,&quot;type&quot;:&quot;image\/jpeg&quot;,&quot;searchStr&quot;:&quot;Desert.jpg:sStrEnd&quot;},</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">{&quot;name&quot;:&quot;files\/pm4fu8uv2u6xc1w.jpg&quot;,&quot;usrName&quot;:&quot;Hydrangeas.jpg&quot;,&quot;size&quot;:595284,&quot;type&quot;:&quot;image\/jpeg&quot;,&quot;searchStr&quot;:&quot;Hydrangeas.jpg:sStrEnd&quot;}]</div></li></ol></pre>
<h3>3. Customization</h3>
<p>Now it's the time to customize our plugin. Users may need to change the appearance and behaviour of signature pad i.e. </p>
<ul>
<li>change width and height of signature pad
<li>change background color
<li>change folder where image files are stored
<li>make signature pad field required
</ul>
<p>As a first step we need to learn to pass settings from PHPRunner wizard to plugin. Proceed to "Edit as" dialog in PHRRunner and click 'Add initialization script' button. Here is the sample set of settings of SignaturePad control:</p>
<p>PHP</p>
<pre class="php"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// signature field height</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">settings</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;height&quot;</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #cc66cc;">100</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// signature field width</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">settings</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;width&quot;</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #cc66cc;">300</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// signature background color</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">settings</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;bgcolor&quot;</span><span style="color: #66cc66;">&#93;</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span>0xff, 0xff, 0xff<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// set it to true to make signature field required</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">settings</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;required&quot;</span><span style="color: #66cc66;">&#93;</span>=<span style="color: #000000; font-weight: bold;">false</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// folder to store signature files</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">settings</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;folder&quot;</span><span style="color: #66cc66;">&#93;</span>=<span style="color: #ff0000;">&quot;files&quot;</span>;</div></li></ol></pre>
<p>ASP</p>
<pre class="asp"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #008000;">' signature field height</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">this_object.<span style="color: #9900cc;">settings</span><span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #cc0000;">&quot;height&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span> = <span style="color: #800000;">100</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #008000;">' signature field width</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">this_object.<span style="color: #9900cc;">settings</span><span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #cc0000;">&quot;width&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span> = <span style="color: #800000;">300</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #008000;">' signature background color</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">this_object.<span style="color: #9900cc;">settings</span><span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #cc0000;">&quot;bgcolor&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span> = <span style="color: #cc0000;">&quot;#FFFFFF&quot;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #008000;">' set it to true to make signature field required</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">this_object.<span style="color: #9900cc;">settings</span><span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #cc0000;">&quot;required&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span>=<span style="color: #0000ff; font-weight: bold;">false</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #008000;">' folder to store signature files</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">this_object.<span style="color: #9900cc;">settings</span><span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #cc0000;">&quot;folder&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span>=<span style="color: #cc0000;">&quot;files&quot;</span></div></li></ol></pre>
<p>This code is self-descriptive, you can pass any number of settings there. If you create your own edit control plugin place sample initialization script to <em>sample.php</em> file that needs to be located in the plugin folder.</p>
<p>Now we can access those settings in plugin's <em>initUserControl()</em> function. We can also pass settings to Javascript part of the plugin.</p>
<p>PHP</p>
<pre class="php"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// setting default value</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">required</span> = <span style="color: #000000; font-weight: bold;">false</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// saving settings to the local variable</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">settings</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;required&quot;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	<span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">required</span>=<span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">settings</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;required&quot;</span><span style="color: #66cc66;">&#93;</span>;		</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">// passing settings to Javascript</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">addJSSetting</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;required&quot;</span>, <span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">required</span><span style="color: #66cc66;">&#41;</span>;</div></li></ol></pre>
<p>ASP</p>
<pre class="asp"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">this.<span style="color: #9900cc;">addJSSetting_p2</span> <span style="color: #cc0000;">&quot;required&quot;</span>, this.<span style="color: #9900cc;">settings</span><span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #cc0000;">&quot;required&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span></div></li></ol></pre>
<p>Now let's actually add some new functionality</p>
<h4>Making signature field required</h4>
<p>In Javascript init() function add the following code:</p>
<pre class="javascript"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">required</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">addValidation</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;IsRequired&quot;</span><span style="color: #66cc66;">&#41;</span>;</div></li></ol></pre>
<p>Signature is not required by default. To make it required add the following line of code to initialization script under 'Edit as' properties: </p>
<p>PHP</p>
<pre class="php"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">settings</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;required&quot;</span><span style="color: #66cc66;">&#93;</span>=<span style="color: #000000; font-weight: bold;">true</span>;</div></li></ol></pre>
<p>ASP</p>
<pre class="asp"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">this_object.<span style="color: #9900cc;">settings</span><span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #cc0000;">&quot;required&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span>=<span style="color: #0000ff; font-weight: bold;">true</span></div></li></ol></pre>
<h4>Setting width and height of signature pad</h4>
<p>Passing width and height from 'Edit as' settings in PHPRunner:</p>
<p>PHP</p>
<pre class="php"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">settings</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;height&quot;</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #cc66cc;">100</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">settings</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;width&quot;</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #cc66cc;">300</span>;</div></li></ol></pre>
<p>ASP</p>
<pre class="asp"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">this_object.<span style="color: #9900cc;">settings</span><span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #cc0000;">&quot;height&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span> = <span style="color: #800000;">100</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">this_object.<span style="color: #9900cc;">settings</span><span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #cc0000;">&quot;width&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span> = <span style="color: #800000;">300</span></div></li></ol></pre>
<p>Then we can use <em>$this-&gt;width</em> and <em>$this-&gt;height</em> in buildUserControl() function to specify width and height of our control:</p>
<p>&lt;canvas class="pad" width="'.<strong>$this->width</strong>.'" height="'.<strong>$this-&gt;height</strong>.'">&lt;/canvas&gt;</p>
<h4>Changing folder where signature images stored</h4>
<p>Passing folder name from 'Edit as' settings in PHPRunner:</p>
<p>PHP</p>
<pre class="php"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">settings</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;folder&quot;</span><span style="color: #66cc66;">&#93;</span>=<span style="color: #ff0000;">&quot;files&quot;</span>;</div></li></ol></pre>
<p>ASP</p>
<pre class="asp"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">this_object.<span style="color: #9900cc;">settings</span><span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #cc0000;">&quot;folder&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span>=<span style="color: #cc0000;">&quot;files&quot;</span></div></li></ol></pre>
<p>Using this variable in <em>readWebValue()</em> function:</p>
<p>PHP</p>
<pre class="php"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$filename</span>= <span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">folder</span>.<span style="color: #ff0000;">&quot;/&quot;</span>.generatePassword<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">15</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">&quot;.png&quot;</span>;</div></li></ol></pre>
<p>ASP</p>
<pre class="asp"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">filename = generatePassword<span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #800000;">15</span><span style="color: #006600; font-weight:bold">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff; font-weight: bold;">var</span> = Base64Decode<span style="color: #006600; font-weight:bold">&#40;</span>this_object.<span style="color: #9900cc;">webValue</span><span style="color: #006600; font-weight:bold">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">runner_save_file CSmartStr<span style="color: #006600; font-weight:bold">&#40;</span>getabspath<span style="color: #006600; font-weight:bold">&#40;</span>this_object.<span style="color: #9900cc;">settings</span><span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #cc0000;">&quot;folder&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span><span style="color: #006600; font-weight:bold">&#41;</span><span style="color: #006600; font-weight:bold">&#41;</span> &amp; <span style="color: #cc0000;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span> &amp; filename &amp; &quot;</span>.<span style="color: #9900cc;">png</span><span style="color: #cc0000;">&quot; , var</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #cc0000;"</span></div></li></ol></pre>
<h4>Changing signature pad background color</h4>
<p>Passing background color from 'Edit as' settings in PHPRunner:</p>
<p>PHP</p>
<pre class="php"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">settings</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;bgcolor&quot;</span><span style="color: #66cc66;">&#93;</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span>0xff, 0xff, 0xff<span style="color: #66cc66;">&#41;</span>;</div></li></ol></pre>
<p>ASP</p>
<pre class="asp"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">this_object.<span style="color: #9900cc;">settings</span><span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #cc0000;">&quot;bgcolor&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span> = <span style="color: #cc0000;">&quot;#FFFFFF&quot;</span></div></li></ol></pre>
<p><em>bgcolor</em> array contains color value in RGB format (Red, Green, Blue, each color ranges from 0 to 255, 0xff is a hexadecimal representation of 255. array(0xff, 0xff, 0xff) means white color. </p>
<p>Now in Javascript control constructor function we can use <em>this.bgColor</em> to pass background color to SignaturePad control:</p>
<pre class="javascript"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'.sigPad'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">signaturePad</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>drawOnly:<span style="color: #003366; font-weight: bold;">true</span>, bgColour: <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">bgColor</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div></li></ol></pre>
<p>We also need to pass backgound color to sigJsonToImage() function that converts JSON signature data to image. We use $this->bgcolor variable here in readWebValue() PHP function.</p>
<p>PHP</p>
<pre class="php"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$img</span> = sigJsonToImage<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">webValue</span>, <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #ff0000;">'imageSize'</span> =&gt; <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">width</span>, <span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">height</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		,<span style="color: #ff0000;">'bgColour'</span> =&gt; <span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">bgcolor</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">		<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div></li></ol></pre>
<p>This is it. As you can creating your own edit control plugins is not a rocket science and you can build something useful in just a few lines of code.</p>
<p>Lets us know what kind of edit controls you want us to implement. If you have one in mind feel free to post detailed description here and provide some links to sample implementation. </p>
<h2>Developer notes</h2>
<h4>File naming conventions</h4>
<p>Your edit plugin might need to utilize some additional PHP, JS and CSS files. Files can be added to the main plugin folder or to subfolders like "include" or "img". Files from the main plugin directory will be copied to the output directory. Files from "include" directory will be copied to "<output dir>/include" etc. Considering the fact that your application may use multiple plugins we suggest providing unique names to helper files. For instance, if your plugin name is <em>Slider</em> naming CSS file <em>slider.css</em> is a good idea.</p>
<h4>Inline edit considerations</h4>
<p>To make sure edit control content is not wrapped while in inline edit mode we recommend to enclose the whole control into a &lt;div> tag. This needs to be done in <em>buildUserControl</em> function in PHP or ASP code.</p>
<h4>Access to field properties</h4>
<p>In some situations you might need to access database field properties i.e. to find this field type. Here is PHP code that does the job:</p>
<p>PHP</p>
<pre class="php"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/global"><span style="color: #000066;">global</span></a> <span style="color: #0000ff;">$strTableName</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$pSet</span> = <span style="color: #000000; font-weight: bold;">new</span> ProjectSettings<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$strTableName</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>IsDateFieldType<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$pSet</span>-&gt;<span style="color: #006600;">getFieldType</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">field</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">   <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">      <span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">webValue</span> = <span style="color: #ff0000;">&quot;2000-01-01 &quot;</span>.<span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">webValue</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">   <span style="color: #66cc66;">&#125;</span></div></li></ol></pre>
<p>ASP</p>
<pre class="asp"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #990099; font-weight: bold;">if</span><span style="color: #006600; font-weight:bold">&#40;</span>IsDateFieldType<span style="color: #006600; font-weight:bold">&#40;</span>this_object.<span style="color: #9900cc;">pageObject</span>.<span style="color: #9900cc;">pSetEdit</span>.<span style="color: #9900cc;">getFieldType_p1</span><span style="color: #006600; font-weight:bold">&#40;</span>this_object.<span style="color: #9900cc;">field</span><span style="color: #006600; font-weight:bold">&#41;</span><span style="color: #006600; font-weight:bold">&#41;</span><span style="color: #006600; font-weight:bold">&#41;</span> <span style="color: #990099; font-weight: bold;">then</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">	this_object.<span style="color: #9900cc;">webValue</span> = <span style="color: #cc0000;">&quot;2000-01-01 &quot;</span> &amp; this_object.<span style="color: #9900cc;">webValue</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #990099; font-weight: bold;">end</span> <span style="color: #990099; font-weight: bold;">if</span></div></li></ol></pre>
<h4>Cleaning up</h4>
<p>If your plugin creates popup you need to destroy them properly. The best option is to implement a destructor of Javascript control destroying all previously open windows. An example from BootstrapTimepicker control:</p>
<pre class="javascript"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">destructor: <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">// call parent</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Runner.<span style="color: #006600;">controls</span>.<span style="color: #006600;">EditBootstrapTimepicker</span>.<span style="color: #006600;">superclass</span>.<span style="color: #006600;">destructor</span>.<span style="color: #006600;">call</span><span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;#&quot;</span>+<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">valContId</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">timepicker</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'hideWidget'</span><span style="color: #66cc66;">&#41;</span>;</div></li></ol></pre>
<h4>Using z-index property</h4>
<p>We suggest to avoid using z-index CSS property in your custom controls to minimize interference with built-in functionality like popup windows. If you absolutely must to use this property make sure the top most container of your control has z-index of 0. </p>
]]></content:encoded>
			<wfw:commentRss>http://xlinesoft.com/blog/2012/09/07/how-to-create-your-own-edit-control-plugin/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Preview of new features in PHPRunner 6.2 and ASPRunnerPro 7.2</title>
		<link>http://xlinesoft.com/blog/2012/07/04/preview-of-some-new-features-in-phprunner-6-2-and-asprunnerpro-7-2/</link>
		<comments>http://xlinesoft.com/blog/2012/07/04/preview-of-some-new-features-in-phprunner-6-2-and-asprunnerpro-7-2/#comments</comments>
		<pubDate>Wed, 04 Jul 2012 23:29:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP Code Generator]]></category>
		<category><![CDATA[PHP Form Generator]]></category>

		<guid isPermaLink="false">http://xlinesoft.com/blog/?p=623</guid>
		<description><![CDATA[<p>We plan to release a beta version of new PHPRunner and ASPRunnerPro in August-September 2012. Here are some of new features you can expect in this update.</p> <h2>New file/image upload control</h2> select and upload multiple files at once. You only need one database field to store all file names. customizable list of allowed file <span style="color:#777"> . . . &#8594; Read More: <a href="http://xlinesoft.com/blog/2012/07/04/preview-of-some-new-features-in-phprunner-6-2-and-asprunnerpro-7-2/">Preview of new features in PHPRunner 6.2 and ASPRunnerPro 7.2</a></span>]]></description>
			<content:encoded><![CDATA[<p>We plan to release a beta version of new PHPRunner and ASPRunnerPro in August-September 2012. Here are some of new features you can expect in this update.</p>
<h2>New file/image upload control</h2>
<ul>
<li>select and upload multiple files at once. You only need one database field to store all file names.</li>
<li>customizable list of allowed file extensions</li>
<li>max number of files</li>
<li>file size restriction (for each file individually and total upload size)</li>
<li>customizable path to upload folder. May contain PHP variables. No need to write events code if you want to save each user' files to separate folder. Sample upload path: <em>$_SESSION["ProjectID"]."/".$_SESSION["UserID"]</em></li>
<li>Drag-n-drop upload - drag files from your desktop right to web page</li>
</ul>
<p>Upload settings:</p>
<p><img class="size-full wp-image-629" title="upload_settings" src="http://xlinesoft.com/blog/wp-content/uploads/2012/07/upload_settings.png" alt="" width="503" height="584" /></p>
<p><span id="more-623"></span>Upload control in generated application:</p>
<p><img class="size-full wp-image-632" title="Upload_control" src="http://xlinesoft.com/blog/wp-content/uploads/2012/07/Upload_control.png" alt="" width="826" height="522" /></p>
<h2>Layout editor</h2>
<p>Now you can change the layout of any page right in Style Editor. Comes with live preview.</p>
<p>On this screenshot you can see buttons section copy/pasted to the top of the page.</p>
<p><img class="size-full wp-image-627" title="layout_add_page" src="http://xlinesoft.com/blog/wp-content/uploads/2012/07/layout_add_page.png" alt="" width="814" height="595" /></p>
<h2>Improved fields and columns resizing in Visual Editor</h2>
<p>Now you can set width and height of any field on Add/Edit pages simply dragging it's edge. There are some enhancements related to list/print page columns resizing as well.</p>
<p><img class="size-full wp-image-628" title="resize_edit_controls" src="http://xlinesoft.com/blog/wp-content/uploads/2012/07/resize_edit_controls.png" alt="" width="577" height="412" /></p>
<h2>Adding custom pages to your application</h2>
<p>Add a brand new page to your application or import existing one. You can import the whole folder with HTML, images, CSS files and edit/preview them in Visual Editor.</p>
<p><img class="size-full wp-image-626" title="custom_files" src="http://xlinesoft.com/blog/wp-content/uploads/2012/07/custom_files.png" alt="" width="792" height="574" /></p>
<h2>Editing of mobile pages in Visual Editor</h2>
<p>The current version of ASPRunnerPro and PHPRunner don't allow you to customize mobile pages appearance. Now you can do this for any chosen page i.e. add a button or change the page layout.</p>
<h2>Minor features</h2>
<ul>
<li>Multilanguage support in Web report/chart builder</li>
<li>Edit contol plugins. This a pretty cool feature in fact. Someone can develop a new Edit control and add it to PHPRunner without need to wait while we added this as a new feature. For example, you need to develop a control to enter credit card expiration year/month storing it as a single value in the database. Or you need develop Google Maps based control that allows users browse the map and pick a pair or latitude/longitude coordinates. That's where Edit control plugins come handy. Once people start creating useful edit controls we'll setup an exchange area where people can sell controls or offer them free of charge to community.</li>
<li>YUI library updated to version 3. Better load speed, more errors fixed.</li>
<li>Convenient data filtering via URL parameters. Sample search URL: <em>carsmodels_list.php?q=(make~equals~Volvo)(&lt;model~сontains~70). </em>This sort of parameters can be added to any List, Print, Report or Chart pages.</li>
<li>New events (IsRecordEditable). Implement custom rules to define when and who each record can be edited.</li>
<li>option to attach files from built-in PHPRunner/ASPRunnerPro email functions</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://xlinesoft.com/blog/2012/07/04/preview-of-some-new-features-in-phprunner-6-2-and-asprunnerpro-7-2/feed/</wfw:commentRss>
		<slash:comments>62</slash:comments>
		</item>
		<item>
		<title>How to troubleshoot Javascript errors</title>
		<link>http://xlinesoft.com/blog/2012/05/22/how-to-troubleshoot-javascript-errors/</link>
		<comments>http://xlinesoft.com/blog/2012/05/22/how-to-troubleshoot-javascript-errors/#comments</comments>
		<pubDate>Tue, 22 May 2012 23:12:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP Code Generator]]></category>
		<category><![CDATA[PHP Form Generator]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://xlinesoft.com/blog/?p=591</guid>
		<description><![CDATA[<p>In this article we will be focusing on debugging and troubleshooting the JavaScript errors. We will look at few examples to illustrate the methods used.</p> <p>For this purpose we will be using developers tools that come with Chrome browser. If you use Firefox - download and install the Firebug. Firebug is an extension to <span style="color:#777"> . . . &#8594; Read More: <a href="http://xlinesoft.com/blog/2012/05/22/how-to-troubleshoot-javascript-errors/">How to troubleshoot Javascript errors</a></span>]]></description>
			<content:encoded><![CDATA[<p>In this article we will be focusing on debugging and troubleshooting the JavaScript errors. We will look at few examples to illustrate the methods used.</p>
<p>For this purpose we will be using developers tools that come with Chrome browser. If you use Firefox -<br />
 download and install the Firebug. Firebug is an extension to Mozilla Firefox web browser which allows us to monitor and debug the JavaScript in any web page. </p>
<pre class="javascript"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> ctrlPrice = Runner.<span style="color: #006600;">getControl</span><span style="color: #66cc66;">&#40;</span>pageid, <span style="color: #3366CC;">'Price'</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> ctrlQuantity = Runner.<span style="color: #006600;">getControl</span><span style="color: #66cc66;">&#40;</span>pageid, <span style="color: #3366CC;">'Quantity'</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> ctrlTotals = Runner.<span style="color: #006600;">getControl</span><span style="color: #66cc66;">&#40;</span>pageid, <span style="color: #3366CC;">'Total'</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">function</span> func<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ctrlTotals.<span style="color: #006600;">setValue</span><span style="color: #66cc66;">&#40;</span>+ctrlPrice.<span style="color: #006600;">getValue</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>*+ctrlQuantity.<span style="color: #006600;">getValue</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ctrlprice.<span style="color: #006600;">on</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'keyup'</span>, func<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ctrlQuantity.<span style="color: #006600;">on</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'keyup'</span>, func<span style="color: #66cc66;">&#41;</span>;</div></li></ol></pre>
<p>Let take a look at our first example where we intentionally misspelled the name of the field used in defining the <em>ctrlPrice</em> variable on the JavaScript OnLoad event (ctrlPrice vs ctrlprice, case sensitive).  Since this is not a syntax error the Syntax Check won't pick up on it but browser will. One thing to note here is when you are troubleshooting and you build your project, you might want to uncheck the "Compress javascript files" option on the Output step. This will organize the code in the way that is much easier to follow.  </p>
<p>So, when the page is loaded we click F12 to display developers tools panel. We can see our error message there and by clicking error message we can get right to the line of code that causes the trouble. Error message in popup says: <strong>'ctrlprice is not defined'</strong>. Replacing <em>ctrlprice</em> with correct <em>ctrlPrice</em> fixes the issue.</p>
<p><img src="http://xlinesoft.com/blog/wp-content/uploads/2012/05/javascript_not_defined.png" alt="" title="javascript_not_defined" width="770" height="642" class="alignleft size-full wp-image-599" /></p>
<p>Let's take a look at another example where we are calculating amount on the fly and are not getting the anticipated result. We are calculating the order by multiplying the number of units in the order by the price of the unit and adding a tax to the equation. </p>
<pre class="javascript"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> ctrlPrice = Runner.<span style="color: #006600;">getControl</span><span style="color: #66cc66;">&#40;</span>pageid, <span style="color: #3366CC;">'Price'</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> ctrlQuantity = Runner.<span style="color: #006600;">getControl</span><span style="color: #66cc66;">&#40;</span>pageid, <span style="color: #3366CC;">'Quantity'</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> ctrlTotals = Runner.<span style="color: #006600;">getControl</span><span style="color: #66cc66;">&#40;</span>pageid, <span style="color: #3366CC;">'Total'</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">function</span> func<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> total=ctrlPrice.<span style="color: #006600;">getValue</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>*+ctrlQuantity.<span style="color: #006600;">getValue</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ctrlTotals.<span style="color: #006600;">setValue</span><span style="color: #66cc66;">&#40;</span>total * total*<span style="color: #CC0000;">0.1</span> <span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ctrlprice.<span style="color: #006600;">on</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'keyup'</span>, func<span style="color: #66cc66;">&#41;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ctrlQuantity.<span style="color: #006600;">on</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'keyup'</span>, func<span style="color: #66cc66;">&#41;</span>;</div></li></ol></pre>
<p>And here is the result it produces:</p>
<p><img src="http://xlinesoft.com/blog/wp-content/uploads/2012/05/javascript_tax_error.png" alt="" title="javascript_tax_error" width="627" height="388" class="alignleft size-full wp-image-600" style='float: none'/></p>
<p>So, in the order where we have 3 units at $120 each with 10% sales tax our total should be $396 dollars. However, the total we are getting is $12960. To troubleshoot the issue we will insert a breakpoint in our Javascript code and watch the values of each part of the equation separately to identify the error. To add a breakpoint we need to proceed to <em>Scripts</em> tab in Developers tools, find our file (<em>pageevents_Order.js</em>) and click the line number we we want to set our breakpoint. </p>
<p><img src="http://xlinesoft.com/blog/wp-content/uploads/2012/05/javascript_debug1.png" alt="" title="javascript_debug1" width="760" height="598" class="alignleft size-full wp-image-597" /></p>
<p>Once breakpoint is inserted put cursor to <em>Quantity</em> field and hit any arrow key on the keyboard. Program execution stops and we can see what's going on. We can use F10 key to move to the next line of code (Step over). </p>
<p>Now lets add a few watch expressions on the right side. We can see that total and tax are calculated properly however we multiplying them instead of adding up which causes the error. A simple correction in the equation logic solves the issue.   </p>
<p><img src="http://xlinesoft.com/blog/wp-content/uploads/2012/05/javascript_debug2.png" alt="" title="javascript_debug2" width="760" height="598" class="alignleft size-full wp-image-598" /></p>
<p>Real life examples are more complicated though basic troubleshooting techniques are the same. As a first step make sure there are no runtime Javascript errors then set a breakpoint and step through the code to find logic flaws. </p>
<p>You can also <a target=_blank href="http://xlinesoft.com/tutorials/JavascriptDebugging.html">watch a video version</a> of this tutorial. </p>
]]></content:encoded>
			<wfw:commentRss>http://xlinesoft.com/blog/2012/05/22/how-to-troubleshoot-javascript-errors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Troubleshooting charts in PHPRunner and ASPRunnerPro applications</title>
		<link>http://xlinesoft.com/blog/2012/05/22/troubleshooting-charts-in-phprunner-and-asprunnerpro-applications/</link>
		<comments>http://xlinesoft.com/blog/2012/05/22/troubleshooting-charts-in-phprunner-and-asprunnerpro-applications/#comments</comments>
		<pubDate>Tue, 22 May 2012 17:46:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://xlinesoft.com/blog/?p=580</guid>
		<description><![CDATA[<p>In this tutorial we'll find out how to troubleshoot chart errors in our applications. PHPRunner and ASPRunnerPro applications use Flash-based charting component that receives data in XML format. If any error happens while generating XML input you will see the following message instead of chart:</p> XML Parser failure: The element type must be terminated <span style="color:#777"> . . . &#8594; Read More: <a href="http://xlinesoft.com/blog/2012/05/22/troubleshooting-charts-in-phprunner-and-asprunnerpro-applications/">Troubleshooting charts in PHPRunner and ASPRunnerPro applications</a></span>]]></description>
			<content:encoded><![CDATA[<p>In this tutorial we'll find out how to troubleshoot chart errors in our applications. PHPRunner and ASPRunnerPro applications use Flash-based charting component that receives data in XML format. If any error happens while generating XML input you will see the following message instead of chart:</p>
<pre>XML Parser failure:
The element type must be terminated by the matching end-tag.</pre>
<p>Lets go a bit deeper. Right anywhere on the page (except on chart itself) and choose 'View source'. In HTML source search for the first occurrence of <strong>dchartdata.php?</strong> (<strong>dchartdata.asp?</strong> in ASPRunnerPro) string. You should see something like this:</p>
<p><img src="http://xlinesoft.com/blog/wp-content/uploads/2012/05/chart_dchartdata.png" alt="" title="chart_dchartdata" width="737" height="548" class="alignleft size-full wp-image-587" /></p>
<p>Highlight <strong>dchartdata.php?chartname=Cars_Chart</strong> part, right click on it and choose <em>Copy</em>. Now paste it to the browser address line replacing <em>Cars_Chart_chart.php</em>. URL is supposed to look like this: <em>http://yourwebsite.com/dchartdata.php?chartname=Cars_Chart</em>. Hit Enter.</p>
<p><img src="http://xlinesoft.com/blog/wp-content/uploads/2012/05/chart_dchartdata_browser.png" alt="" title="chart_dchartdata_browser" width="741" height="516" class="alignleft size-full wp-image-582" /></p>
<p><strong>dchartdata</strong> file generates XML. As we can see something went wrong and this file produces the error. View the source of this page again. Search for 'php error happened' string ('asp error happened' in ASPRunnerPro). </p>
<p><img src="http://xlinesoft.com/blog/wp-content/uploads/2012/05/chart_error_found.png" alt="" title="chart_error_found" width="849" height="560" class="alignleft size-full wp-image-583" /></p>
<p>Now we can see the actual error message. In this specific case table named 'Cars' s missing in the database. Probably table was removed or renamed after project was built. To fix this you either need to change the chart definition in your project or to rename this table back. </p>
]]></content:encoded>
			<wfw:commentRss>http://xlinesoft.com/blog/2012/05/22/troubleshooting-charts-in-phprunner-and-asprunnerpro-applications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Troubleshooting custom buttons in PHPRunner and ASPRunnerPro applications</title>
		<link>http://xlinesoft.com/blog/2012/05/16/troubleshooting-custom-buttons-in-phprunner-and-asprunnerpro-applications/</link>
		<comments>http://xlinesoft.com/blog/2012/05/16/troubleshooting-custom-buttons-in-phprunner-and-asprunnerpro-applications/#comments</comments>
		<pubDate>Wed, 16 May 2012 16:59:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://xlinesoft.com/blog/?p=554</guid>
		<description><![CDATA[<p>Lets says you have a database of cars. You have added a button to the List page that should update selected cars statuses as 'Sold'. Your code looks good and passes syntax check still doesn't work when you run your application. The worst of all - it doesn't produce any visible errors. In this <span style="color:#777"> . . . &#8594; Read More: <a href="http://xlinesoft.com/blog/2012/05/16/troubleshooting-custom-buttons-in-phprunner-and-asprunnerpro-applications/">Troubleshooting custom buttons in PHPRunner and ASPRunnerPro applications</a></span>]]></description>
			<content:encoded><![CDATA[<p>Lets says you have a database of cars. You have added a button to the List page that should update selected cars statuses as 'Sold'. Your code looks good and passes syntax check still doesn't work when you run your application. The worst of all - it doesn't produce any visible errors. In this article I'll show you how to catch errors like this one.</p>
<p><img src="http://xlinesoft.com/blog/wp-content/uploads/2012/05/button_browser.png" alt="" title="button_browser" width="688" height="313" class="alignleft size-full wp-image-558" /></p>
<p>We are going to need either Chrome or Firefox with Firebug addon installed. Our screenshots are taken in Chrome. Open your list page, hit F12 to display developers tools panel and proceed to Network tab. You should see something like this:</p>
<p>Now select a few records and click 'Update Selected'. A new entry appears under Network tab - browser executes buttonhandler.php (buttonhandler.asp in ASPRunnerPro) file where our server side code is stored. If we expand <em>Response</em> tab we can see our error description if any.</p>
<p><img src="http://xlinesoft.com/blog/wp-content/uploads/2012/05/button_devtools.png" alt="" title="button_devtools" width="959" height="700" class="alignleft size-full wp-image-564" /></p>
<p>In this specific case it says the following under Error description:</p>
<pre>The Microsoft Jet database engine cannot find the input table or query 'car'.  Make sure it exists and that its name is spelled correctly.</pre>
<p>It looks like we have missplled the table name in our code. Replacing 'car' with 'cars' fixes the issue.  This was definitely helpful though some events can be tens or hundreds lines of code long and single error message doesn't provide much help. To find the exact line of code that produces the error scroll down the content of <em>Response</em> tab to find the entry that points to buttonhandler.php file. Here it is:</p>
<pre class="html4strict"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td</span></a> <span style="color: #000066;">nowrap</span>=<span style="color: #ff0000;">&quot;nowrap&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>#3.<span style="color: #ddbb00;">&amp;nbsp;</span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td</span></a> <span style="color: #000066;">nowrap</span>=<span style="color: #ff0000;">&quot;nowrap&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>buttonhandler.php:40<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">&lt;td</span></a> <span style="color: #000066;">nowrap</span>=<span style="color: #ff0000;">&quot;nowrap&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>buttonHandler_Update_Selected<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/td&gt;</span></span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li></ol></pre>
<div>Now we can open buttonhandler.php file in any text editor (Notepad++ recomended) and find line 40:</div>
<p><img src="http://xlinesoft.com/blog/wp-content/uploads/2012/05/button_editor.png" alt="" title="button_editor" width="718" height="545" class="alignleft size-full wp-image-560" /></p>
<p>This also points to the fact that something is not right with our SQL query.</p>
<h3>Additional troubleshooting tips</h3>
<p>You may want save a few troubleshooting steps printing your SQL Queries on the web page instead of executing them. This way you can see what exactly is happening on the server and catch syntax errors faster. To do so assign SQL queries to result["txt"] variable (result("txt") in ASP) and print it on the page using the following code in <em>ClientAfter</em> event.</p>
<pre class="javascript"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ctrl.<span style="color: #006600;">setMessage</span><span style="color: #66cc66;">&#40;</span>result<span style="color: #66cc66;">&#91;</span><span style="color: #3366CC;">&quot;txt&quot;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;</div></li></ol></pre>
<p><b>Sample server PHP code</b></p>
<pre class="php"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$result</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;txt&quot;</span><span style="color: #66cc66;">&#93;</span>=<span style="color: #ff0000;">&quot;&quot;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">foreach</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$keys</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$idx</span>=&gt;<span style="color: #0000ff;">$val</span><span style="color: #66cc66;">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$sql</span> = <span style="color: #ff0000;">&quot;update car set Status='Sold' where id=&quot;</span>.<span style="color: #0000ff;">$val</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;ID&quot;</span><span style="color: #66cc66;">&#93;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$result</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;txt&quot;</span><span style="color: #66cc66;">&#93;</span>.=<span style="color: #0000ff;">$sql</span>.<span style="color: #ff0000;">&quot;&lt;br&gt;&quot;</span>;</div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">//CustomQuery($sql);</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li></ol></pre>
<p><b>Sample server ASP code</b></p>
<pre class="asp"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">esult<span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #cc0000;">&quot;txt&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span>=<span style="color: #cc0000;">&quot;&quot;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #990099; font-weight: bold;">For</span> n = <span style="color: #800000;">0</span> <span style="color: #990099; font-weight: bold;">To</span> keys.<span style="color: #9900cc;">Count</span><span style="color: #800000;">-1</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">sql = <span style="color: #cc0000;">&quot;update car set Status='Sold' where id=&quot;</span> &amp; keys<span style="color: #006600; font-weight:bold">&#40;</span>n<span style="color: #006600; font-weight:bold">&#41;</span><span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #cc0000;">&quot;ID&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">result<span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #cc0000;">&quot;txt&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span> = result<span style="color: #006600; font-weight:bold">&#40;</span><span style="color: #cc0000;">&quot;txt&quot;</span><span style="color: #006600; font-weight:bold">&#41;</span> &amp; sql &amp; <span style="color: #cc0000;">&quot;&lt;br&gt;&quot;</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #008000;">'CustomQuery(sql)</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #990099; font-weight: bold;">next</span></div></li><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div></li></ol></pre>
<p>And here is how this looks in action:</p>
<p><img src="http://xlinesoft.com/blog/wp-content/uploads/2012/05/button_messages.png" alt="" title="button_messages" width="719" height="528" class="alignleft size-full wp-image-569" /></p>
]]></content:encoded>
			<wfw:commentRss>http://xlinesoft.com/blog/2012/05/16/troubleshooting-custom-buttons-in-phprunner-and-asprunnerpro-applications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Video: connection to remote MySQL, XAMPP installation, FTP upload</title>
		<link>http://xlinesoft.com/blog/2012/04/17/video-connection-to-remote-mysql-xampp-installation-ftp-upload/</link>
		<comments>http://xlinesoft.com/blog/2012/04/17/video-connection-to-remote-mysql-xampp-installation-ftp-upload/#comments</comments>
		<pubDate>Tue, 17 Apr 2012 20:49:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP Code Generator]]></category>
		<category><![CDATA[PHP Form Generator]]></category>

		<guid isPermaLink="false">http://xlinesoft.com/blog/?p=551</guid>
		<description><![CDATA[<p>This is the second video in educational series that shows how you can create a simple project, connect to your database, build it and view in browser.</p> <p>Here is the outline:</p> connection to local or remote MySQL database previewing your application using built-in web server XAMPP installation previewing your application using XAMPP's web server <span style="color:#777"> . . . &#8594; Read More: <a href="http://xlinesoft.com/blog/2012/04/17/video-connection-to-remote-mysql-xampp-installation-ftp-upload/">Video: connection to remote MySQL, XAMPP installation, FTP upload</a></span>]]></description>
			<content:encoded><![CDATA[<p>This is the second video in educational series that shows how you can create a simple project, connect to your database, build it and view in browser.</p>
<p>Here is the outline:</p>
<ul>
<li>connection to local or remote MySQL database</li>
<li>previewing your application using built-in web server</li>
<li>XAMPP installation</li>
<li>previewing your application using XAMPP's web server (Apache)</li>
<li>uploading your application to the remote web server</li>
<li>transferring your MySQL database to remote web server</li>
<li>running your application on remote web server</li>
</ul>
<p><a href="http://xlinesoft.com/tutorials/xampp-ftp.html" target="_blank">Watch it on our web site</a> or on <a href="http://youtu.be/mzENxQP6RTQ" target="_blank">Youtube </a>(make sure you choose HD version and view it full screen).</p>
<p>We want to provide you with the best learning experience and at this time asking for your feedback. Feel free to post your comments below.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://xlinesoft.com/blog/2012/04/17/video-connection-to-remote-mysql-xampp-installation-ftp-upload/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dropdowns video tutorial</title>
		<link>http://xlinesoft.com/blog/2012/03/27/dropdowns-video-tutorial/</link>
		<comments>http://xlinesoft.com/blog/2012/03/27/dropdowns-video-tutorial/#comments</comments>
		<pubDate>Tue, 27 Mar 2012 15:09:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://xlinesoft.com/blog/?p=508</guid>
		<description><![CDATA[<p>We are starting a series of educational videos on how to use PHPRunner and ASPRunner. The videos will be complementing our existing tutorials yet covering a larger number of topics in greater depth with many more examples. The topics will be grouped by difficulty levels (Beginners, Intermediate, Advanced) giving you the most comprehensive and <span style="color:#777"> . . . &#8594; Read More: <a href="http://xlinesoft.com/blog/2012/03/27/dropdowns-video-tutorial/">Dropdowns video tutorial</a></span>]]></description>
			<content:encoded><![CDATA[<p>We are starting a series of educational videos on how to use PHPRunner and ASPRunner. The videos will be complementing our existing tutorials yet covering a larger number of topics in greater depth with many more examples. The topics will be grouped by difficulty levels (Beginners, Intermediate, Advanced) giving you the most comprehensive and structured way to learn about PHPrunner and ASPRunner.</p>
<p>This first video in these series covers dropdown boxes. This is a fairly long video (23 minutes). Feel free to skip certain sections. Here is the outline:</p>
<ul>
<li>0:00  Simple dropdown box, hardcoded list of values vs database driven lookup wizard</li>
<li>7:50  Dependent dropdown boxes</li>
<li>11:30 Advanced security applied to dropdown boxes</li>
<li>14:25 Lookup wizard settings</li>
</ul>
<p><a href="http://xlinesoft.com/tutorials/Dropdowns.html" target="_blank">Watch it on our web site</a> or on <a title="Dropdowns video" href="http://youtu.be/-on4tBNpnBs" target="_blank">Youtube </a>(make sure you choose HD version and view it full screen).</p>
<p>We want to provide you with the best learning experience and at this time asking for your feedback. Feel free to fill this short survey to help us understand your needs better.</p>
<p><a href="http://demo.asprunner.net/volinrok_yahoo_com/Survey2/response_add.php?sid=1">Take survey</a></p>
<p>This survey was created by <a href="http://xlinesoft.com/blog/2012/03/09/survey-template/" target="_blank">Survey template</a>.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://xlinesoft.com/blog/2012/03/27/dropdowns-video-tutorial/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
