Form with an image button that link a control application

Dear all,

I’m trying to insert a image button on a form block with an link to a control application.

Just to understand better I have an invoice header with customer address references.
Within a lower block there are all references for shipment.
I need to give to user the possibility to copy the above customer address into the shipment address.

Within the control application I’ve calculated and retrieve address infos I need.

$check_sql = "SELECT CompanyName, Address, City, State, PostalCode, Country FROM customers WHERE CustomerID = ". {CustomerID} ;
sc_lookup(address_string, $check_sql);

//echo "son qui " . {address_string[0][0]} ;

if (isset({address_string[0][0]})) // Row found
{
$check_sql_state = “SELECT description FROM counties where county_ID =”. {address_string[0][3]} ;
sc_lookup(address_state, $check_sql_state);
$check_sql_country = “SELECT description FROM countries where country_ID =”. {address_string[0][5]} ;
sc_lookup(address_country, $check_sql_country);

{ShipName} = {address_string[0][0]};
{ShipAddress} = {address_string[0][1]}; {ShipCity} = {address_string[0][2]}; {ShipRegion} = {address_state[0][0]};
{ShipPostalCode} = {address_string[0][3]}; {ShipCountry} = {address_country[0][0]};

}
else // No row found
{
sc_alert(“Attenzione dati Cliente non esistenti !!”);
}

In control application I haven’t any field but only a method copy_address_button() ;
called from OnScripInit
when I try to run the control application I gave this error: Form fields undefined

I’m stucked here and I don’t know what to do.
Are there workaround or a easy way to achieve my goal ?
Many thanks
Giovanni

address.png

Re: Form with an image button that link a control application

just create a dummy field which will resolve the error message.

Re: Form with an image button that link a control application

Thanks leatheric for suggestion,

could you please explain me better what do you intend with dummy field ?
What I have to do in this field ?

Re: Form with an image button that link a control application

create a text field place it in your control application and set it to hidden !
the failure “form fields undefined” should no longer appear !

Re: Form with an image button that link a control application

Just create the dummy field, and at the field positioning, move it to the left box. Need not place into the form and hide it.