|
|||||||
| PHP Discussion and technical support for using and deploying PHP based websites. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi Guys,
Not sure of the best way to explain this, but I will try my best, please allow room for error as I am no php expert. Here is the scenario. I have a form which basically autofills input and select fields (which ultimately replaces hidden field labels). Now when running through validation, the auto filled text input fields are marked as filled, although the select fields which are also autofilled and have php assigned to the select fields are not marked as filled and validation captures this, which is the desired behaviour. Although I am unsure of how to make the input text field do the same thing. A bit of code may possibly be able help identify and explain the situation a little better. PHP Code:
HTML Code:
<dt><label for="paymentopt">Subscription Period</label></dt> <dd> <select class="select" id="paymentopt" name="paymentopt" value="Subscription Period" tabindex="13"> <option value="">Subscription Period</option> [php]<?php $paymentopt = rv('paymentopt'); foreach ($paymentOptions as $paymentOption) { $selected = ''; if ($paymentopt == $paymentOption) { $selected = 'selected=""'; } echo '<option value="'.$paymentOption.'" '.$selected.'>'.$paymentOption.'</option>'; } ?>[/php] </select> </dd> The problem begins with regular text fields. I cannot set dummy text with a null value as the previous select option can. I need to know how to create an input text value with an initial value that is basically equivilent to null and need the field filled by the user to replace the shown autofilled text. I hope I have explained it in an easy enough way to understand. Here is some current code that does not exactly do the right thing as it utilises the text that was provided in the value for obvious reasons. PHP Code:
HTML Code:
<dt><label for="cname">Customer Name</label></dt> <dd><input type="text" class="filled" id="cname" name="cname" value="Customer Name" tabindex="1" /></dd> I also tried HTML Code:
<input type="text" class="filled" id="cname" name="cname" value="<?php echo rv('cname'); ?>" tabindex="1" />
The <dt> fields are hidden label fields hence they are not utilised visibly. [EDIT]I have a function which autohides the autofilled text when the user clicks in the field so they do not need to delete the preloaded text when filling the field.[/EDIT] Hope this is enough information to give you an understanding of what i am trying to achieve. If not let me know. But I hope somebody can point me in the right direction. Cheers, dvine Last edited by dvine; 11-03-2009 at 08:29 PM. |
|
#2
|
|||
|
|||
|
Not fully sure I know what you want but if you want a dummie text that does not validate if left, could you not just have:
PHP Code:
|
|
#3
|
|||
|
|||
|
G'Day Lukaz.
Thank you so much for your reply. You are correct in coming to the conslusion that I do not want the auto text to pass validation. Here is what I have done. PHP Code:
Are there any other methods, or have I done something incorrectly here? Cheers, dvine Last edited by dvine; 11-04-2009 at 05:33 PM. |
|
#4
|
|||
|
|||
|
Hi Lukaz,
Please ignore my previous post, it appears as though it seems to be working now. I am assuming it is case sensitive, hence the initial test did not work. It appears as though this is now working. I will mark as resolved once I have tested the entire form using this method. Cheers, dvine |
|
#5
|
|||
|
|||
|
Have you mirroed the string exactly? i.e if you value field is Customer Name with cap C and cap N make sure it is the same in the validation script.
EDIT: glad it works |
|
#6
|
|||
|
|||
|
On the money mate.
=) Thank you. |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|