|
Posted by J.O. Aho on 09/28/53 11:41
Good Man wrote:
> "J.O. Aho" <user@example.net> wrote in
> news:46r7pkFchn19U1@individual.net:
>
>
>> I don't really see the point in using javascript at all in this case,
>> you get a more difficulty to figure out bugs.
>>
>> if you use
>>
>> <input type="text" id="firstName" value="<?= $first_name ?>" />
>> <input type="text" id="secondtName" value="<?= $second_name ?>" />
>> <input type="text" id="lastName" value="<?= $last_name ?>" />
>>
>> You either have a value set of the variables $first_name,
>> $second_name, $last_name and so on (I know, I added the two last
>> ones).
>>
>> If a value isn't set, then the box will be empty and it's just to add
>> the values manually.
>
> The only point would be saving me programming time. On a page with 50+
> form-fields, I can save lot of time by writing a PHP loop that writes an
> HTML call to a javscript function instead of going to each form field and
> entering the value="<?= $first_name ?>" stuff...
You have to add the input tag, so adding a little bit extra code don't make a
difference. You could even make a loop that does generate all the input tags
(makes your page even more dynamical), all you would need is id's in a array
(if you use the same name for the variables and the id's).
//Aho
[Back to original message]
|