Hi all!
Today I tried to create new form using the HTML and PHP.
So, the clean HTML code for form works well put if I whant to set any default value for textfield it is not working.
if I write something like this
<input class="formInput" name="middleName" type="text" value="test" />
not working, the field is empty (no 'test' text inside the field),
but if I delete the name attribure everithing works fine.
Does anyone know where is the problem?
Today I tried to create new form using the HTML and PHP.
So, the clean HTML code for form works well put if I whant to set any default value for textfield it is not working.
if I write something like this
<input class="formInput" name="middleName" type="text" value="test" />
not working, the field is empty (no 'test' text inside the field),
but if I delete the name attribure everithing works fine.
Does anyone know where is the problem?
Hi ocatan,
I just pasted that line of code into a new form and it works perfectly - so something else is the problem here.
Bob
I just pasted that line of code into a new form and it works perfectly - so something else is the problem here.
Bob
Hi.
Thanks for reply!
Let me explaind the work scheme. The curent form builded in chronoforms is the result of other form. I have a form with list of items with checkbox for each item and submit button in the bottom of the page, the action fo this form is an url of current chronoform. The current form items is builded based on the previous form result.
I'm using this script to build the list of form textfields:
Here is the result HTML:
As you can see, the value is empty. Where could be the problem?
Thanks for reply!
Let me explaind the work scheme. The curent form builded in chronoforms is the result of other form. I have a form with list of items with checkbox for each item and submit button in the bottom of the page, the action fo this form is an url of current chronoform. The current form items is builded based on the previous form result.
I'm using this script to build the list of form textfields:
<?php
$jobs = $_POST['jobs'];
$i=0;
foreach($jobs as $key=>$job)
{
echo ' <tr bgcolor="#efefef">
<td bgcolor="#ffffff" width="98%" class="bodyCopy">
<input type="text" name="jobtitle'.$i.'" value="'.$job.'" disabled />
</td>
<td bgcolor="#ffffff" width="2%" class="bodyCopy"> </td>
</tr>';
$i++;
}
?>
Here is the result HTML:
<tr bgcolor="#efefef">
<td class="bodyCopy" height="54" bgcolor="#ffffff" width="98%" valign="top">
I am interested in the following position(s):
<br/>
<br/>
<input id="subject0" class="formInput" type="text" maxlength="100" size="30" value="" name="position1"/>
<br/>
</td>
<td class="bodyCopy" bgcolor="#ffffff" width="2%"> </td>
</tr>
<tr bgcolor="#efefef">
<td class="bodyCopy" bgcolor="#ffffff" width="98%">
<input type="text" disabled="" value="" name="jobtitle0"/>
</td>
<td class="bodyCopy" bgcolor="#ffffff" width="2%"> </td>
</tr>
<tr bgcolor="#efefef">
<td class="bodyCopy" bgcolor="#ffffff" width="98%">
<input type="text" disabled="" value="" name="jobtitle1"/>
</td>
<td class="bodyCopy" bgcolor="#ffffff" width="2%"> </td>
</tr>
<tr bgcolor="#efefef">
<td class="bodyCopy" bgcolor="#ffffff" width="98%">
<input type="text" disabled="" value="" name="jobtitle2"/>
</td>
<td class="bodyCopy" bgcolor="#ffffff" width="2%"> </td>
</tr>
As you can see, the value is empty. Where could be the problem?
Hi octan,
The problem is that the $_POST array isn't available to the next Form unles syou save it in the OnSubmit of the previous one.
This application is better suited to a multi-page form.
Either use one form and add PHP to the Form HTML to choose which page to display; or, perhaps easier, use the ChronoForms multi-page plugin which will pass the data from step to step.
Bob
The problem is that the $_POST array isn't available to the next Form unles syou save it in the OnSubmit of the previous one.
This application is better suited to a multi-page form.
Either use one form and add PHP to the Form HTML to choose which page to display; or, perhaps easier, use the ChronoForms multi-page plugin which will pass the data from step to step.
Bob
Hi octan,
The problem is that the $_POST array isn't available to the next Form unles syou save it in the OnSubmit of the previous one.
This application is better suited to a multi-page form.
Either use one form and add PHP to the Form HTML to choose which page to display; or, perhaps easier, use the ChronoForms multi-page plugin which will pass the data from step to step.
Bob
I understand but the first form is not builded using the chronoform componnet, it's a regular HTML code form hardcoded in one of the articles. Anyway, if I made print_r($_POST) in the beginning of hte form it shows all the data I inserted in previous form.
<?php
$jobs = $_POST['jobs'];
$i=0;
foreach($jobs as $key=>$job)
{
echo ' <tr bgcolor="#efefef">
<td bgcolor="#ffffff" width="98%" class="bodyCopy">
<input type="text" name="jobtitle'.$i.'" value="'.$job.'" disabled />
</td>
<td bgcolor="#ffffff" width="2%" class="bodyCopy"> </td>
</tr>';
$i++;
}
?>
In this code if I remove the name attribute of the input field then form is buided fine.
Hi octan,
Sorry, we don't do mind-reading :-(
Try print_r($job); to see what is there.
Bob
Sorry, we don't do mind-reading :-(
Try print_r($job); to see what is there.
Bob
This topic is locked and no more replies can be posted.