Is there a way to fill a wpcf7-form, from http address...lets say by javascript. I have a form in HTML with controls in wpcf7:
<span class="wpcf7-form-control-wrap text-700">
<input class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required" type="text" aria-required="true" size="30" value="" name="NameText">
</span>
For example the web page address is www.example.com/examplefrom Is there a way to auto-fill the text in textfield by running something like: www.example.com/examplefrom;javascript::getElementByID.... I'm not a web developer,but i need to solve this issue...please help
I see your question is tagged with php. So I'll give you an option with php. First you need to check if there is POST data send in the URL
<?php
if($_POST) {
// Here you should take all your data and put it into a variable or an array
$NameText = $_POST['NameText'];
// The URL would look something like this:
// www.example.com/exampleform?NameText=SomeText
}
?>
Now in html you can check if the variable is empty or not and fill in the text if it is available.
<span class="wpcf7-form-control-wrap text-700">
<input class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required" type="text" aria-required="true" size="30" value="<?php echo (isset($NameText))?$NameText:''; ?>" name="NameText">
</span>
Edit: Use <?php echo (isset($NameText))?$NameText:''; ?>
in each value
attribute of the form fields you would like to fill with the data form the url.
Please note: This is a simple example and does not check for save post values. You should check the data if needed. But I figured there will be some security after you click the submit button of the form. So it might not be required..
Hope it helped you out.