[eluser]Unknown[/eluser]
The form_open function in the form_helper is used to open the form. However, by default, the action is to the current
BASE URL, and then to where it is written. E.g. if we type
Code:
echo form_open('mypage');
,
then it will interpret it as
Code:
<form method="post" accept-charset="utf-8" action="http:/example.com/index.php/mypage" />
However, we dont have the option to transfer it to, say j
avascript:doWork() without the base URL.
Hence, I have made a small change in the form_helper file, in which case, if we preceed the parameter with
::, then it will print as it it.
i.e, if we give
Code:
echo form_open('::[javascript]:doWork()', array('name' => 'myform', 'id' => 'myform'));
,
then it will be interpreted as
Code:
<form action="[javascript]:doWork()" method="post" accept-charset="utf-8" name="myform" id="myform">
and NOT as
Code:
<form action="http://localhost/envis_ci/index.php/[javascript]:doWork()" method="post" accept-charset="utf-8" name="myform" id="myform">
For that, I made a small change in
form_helper file. Now it is
Code:
if ($action && strpos($action, '://') === FALSE)
{
$exceptionaction = $action; // This has been added
$action = $CI->config->site_url($action);
}
/** The below three lines have been added **/
if($exceptionaction && strpos($exceptionaction, "::") !== FALSE)
{
$action = preg_replace("/\:\:(.)/", "$1", $exceptionaction);
}
(Please check the
form_helper file in the
systems/helper folder.
I need your humble suggestions.
Vijay
N.B Please read
[javascript] as
javascript in code.