Pls help..
I have a dynamic form in which the no. of elements are not fixed, and i need to perform JS validation on the form. I have a PHP function that will return me an array of all elements that are currently displayed in form. I want to use this in the JS code..
I am trying something lyk dis::
function checkValidation() {
<?php echo
// php function call
$arrColumnsInfo = $this->fetch_fields_info();
print('<pre>');
print_r($arrColumnsInfo);
print('</pre>');
?>
}
Not working for me..throws JS error.. OR this..
function checkValidation() {
<?php=
// php function call
$arrColumnsInfo = $this->fetch_fields_info();?>
alert(<?=$arrColumnsInfo?>);
}
Again.. not working..
My PHP array output:
Array
(
[client_code] => Client Code::1::Basic company Info::desc::TB
[entity_name] => Entity Name::1::Basic company Info::::TB
[type_of_entity] => Type of entity::1::Basic company Info::Type of entity,Sole trader,Partnership,Australian Private Company, other::DD
[fixed_fees] => fixed fees::8::Fees Related::yes,no::RD
[billing_time] => Billing time::8::Fees Related::Weekly,Fortnightly,Monthly,Yearly::DD
)
The key here used is the name of form element.. eg. i am building my form lyk dis..
<input type="text" name="client_code" value="">...
and so on.. and in the same way all form elements are dynamically created. And now i want to validate this form so i again need this array in javascript.