17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 2779 Views |
-
how to put my own form (formular) on webpage

13 March 2008 at 1:37pm
I'd like to put in the source of the content page my own form for example:
<form action="my_script.php" method="post" name="name" id="name">
<input type="company_name" name="textfield">
</form>This form will run my_script.php. The script should process variables sended by post (in this example company_name variable), then give some results (from my own databases) and put it back one the webpage.
How to do it, cause now I have SS parsing error (cant parse form tag):
</form>
------------^ -
Re: how to put my own form (formular) on webpage

13 March 2008 at 8:53pm
you might want to read up on SilverStripe forms - http://doc.silverstripe.com/doku.php?id=tutorial:3-forms. The second part of that - the browser poll you should be able to use/adapt that.
-
Re: how to put my own form (formular) on webpage

14 March 2008 at 1:48am
thanks for support. I've read it.
But the problem is, how to run my own script which will access my own database (from my other application) and give back results on silverstripe page.
could You help me with short instruction.
-
Re: how to put my own form (formular) on webpage

14 March 2008 at 9:26am
right so using the the tutorial code as a template.. theres 2 PHP functions 1- BrowserPollForm() this is the function to output the form so this will be where you add your text fields and submit buttons etc... The second function doBrowserPoll() is much more interesting. This method is what is called when people submit the form.
So I don't know what your my_script.php file does but if you copy the code from that into the doBrowserPoll() function (replacing variables etc etc) and use that method to connect to your database and process the form / do whatever you want.
If you post some code someone might be able to look into it for you.
-
Re: how to put my own form (formular) on webpage

9 April 2008 at 2:39pm
I'm also curious about this.. I need to submit a form to an external site for processing. I cannot get the code from the remote location as it's a third party processor.
So in short I would love the ability to customise the action tag of the <form> tag. I realise that this may be accomplished with javascript on the user end, but this does not work for two reasons:
1) The odd chance that the user does not have js enabled.
2) That I already have a script rewriting the action tag (also third party js!)Thanks for any help!
-
Re: how to put my own form (formular) on webpage

9 April 2008 at 4:34pm
Thanks to simon_w in the SS chat room i've fixed my problem.
Simply sub class the Form class like so and replace the FormAction function with what you want in the action attribute:
class extForm extends Form {
function init() {
parent::init();
}
function FormAction() {
return 'http://www.myexternalsite.com/processes-tha-forms';
}
}Then reference the new form like so
return new extForm($this, 'extContactForm', $fields, $actions, $validator);
Thanks simon!
| 2779 Views | ||
|
Page:
1
|
Go to Top |



