This topic is locked

Hiding fields but adding in the background.

10/22/2009 3:49:39 AM
PHPRunner General questions
S
swanside author

Hello.

WHen we add a new job to our job table, we select an engineer name from a drop down list from the accounts table. The engineer name has a unique id called engineerId.

On the Add page for the new job it displays the Engineer name as a dropdown, and below it it has the engineerid as lookup wizard based on the engineers name.

We then export the job as an xml file and it has the results as shown below.

This process is repeated in a fashion for the fields at the bottome of the xml for the POstCode, Line1, doorcode and so on. These are determined by the OrderSiteAddress.

To keep the page smaller, is it possible to hide these fields so when we select an engineers Name and the order site address, it will still carry the information into the EngineerId, PostCode, Line1 and so on?

Thanks

Paul

- <row>

<LoggedBy>PAUL</LoggedBy>

<PhoneNumber />

<OrderDate>2009-10-14 00:00:00</OrderDate>

<FileNo>AB 1234</FileNo>

<CustomerName>MY FM LTD</CustomerName>

<OrderSiteAddress>MY HIGH SCHOOL</OrderSiteAddress>

<JobDescription>TO ALTER PIPEWORK FROM COLD WATER STORAGE TANK NO1 THAT RUNS NEXT TO AHU DUCTWORK AND INSULATE</JobDescription>

<JobNo>1000000</JobNo>

<EngineerId>24</EngineerId>

<JobTypeId>1</JobTypeId>

<PostCode />

<Line1 />

<DoorCode />

<GateCode />

<AlarmCode />

<ExtraCodes />

</row>

P
petzov 11/4/2009

Hi,

As I also was looking for hidden fields, and didn't get it. Here is a workaround.

You delete all unnecessary fields from the add form. Then you add an event in Before Record Added function. Click the button "Add Action" -> "Check if specific record exists". Then then you assign what you got the $userdata array.
Here is an example:
global $conn;

$strSQLExists = "select * from AnyTable where SomeColumn='".$values['LoggedBy'];

$rsExists = db_query($strSQLExists,$conn);

$whatYouGot=db_fetch_array($rsExists);

if($whatYouGot)

{

$userdata['EngineerId']=$whatYouGot['EngineerId'];

$userdata['PostCode']=$whatYouGot['PostCode'];

etc.

}
This way you have a better control of the data.

Hope this helps