CodeIgniter Forums
Using Form Helpers - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Using Form Helpers (/showthread.php?tid=4884)



Using Form Helpers - El Forum - 12-21-2007

[eluser]Unknown[/eluser]
Good day all,

i have been playing around with the CI's form helper, the helper has a function called form_submit(), i usually don't use the submit button to submit my forms, instead use images or buttons to call a javascript function which then submits the related form. Now my question is, is there a feature for calling form_button()? or maybe to include images as a button to achieve my task?

Thanks


Using Form Helpers - El Forum - 12-21-2007

[eluser]Unknown[/eluser]
Hi again, or is it possible for me not to use the CI's form helper, but create my own classes. is that advisable? performance, resource usage wise, please advise


Using Form Helpers - El Forum - 12-21-2007

[eluser]tonanbarbarian[/eluser]
most of the form helpers can have arrays of data passed to them
so to create an image submit use something like the following
Code:
form_submit(
  array(
    'name'=>'submit',
    'value'=>'submitted',
    'type'=>'image',
    'src'=>'img/submitbutton.png',
    'id'=>'my_submit',
    'onclick'=>'return myformclick();'
  )
);
this will produce something similar to this
Code:
<input name="submit" value="submitted" type="image" src="img/submitbutton.png" id="my_submit" onclick="return myformclick();" />
so the example shows how you can do both image submit and onclick using the form_submit helper function