Forums

set textfield value from php

aiken3000 01 Sep, 2014
Hi everyone. I'm trying to understand how to set textfield values from php.
Seems to be a pretty simple task but I'm stuck:

I have 3 fields: "nome", "cognome" and "importo".
I put this script in the onLoad section under the "Setup" tab, before the HTML render form action:

<?php
$form->data['cognome'] = "---";
?>


But nothing changes.

It is just a test because my goal is to process a querystring value and then put it into a hidden field.

Any help?
GreyHead 02 Sep, 2014
Hi aiken3000,

I would expect that to work OK.

You don't need to parse the query string, ChronoForms does that automatically, If there is a cognome=xxx in the query string used to load the form and you have an input named cognome then the value should be set for you.

Bob
aiken3000 02 Sep, 2014
Hi, thanks for your reply.
The parameter is the id of a database row, I need to retrieve a text from the db based on the id and then print it to a field value.

I tried with a hidden field and it works, only with normal textfields nothing happens.
aiken3000 02 Sep, 2014
OOpps, I figured it out. I typed the field name wrong, assuming it was the label.

Sorry for wasting your time...
This topic is locked and no more replies can be posted.