This topic is locked

custom dropbox

11/22/2011 10:33:36 PM
PHPRunner General questions
W
wildwally author

I have the need for a custom dropbox with a Yes / No option default should be "No". I could create a field in the database and easily accomplish the task with the visual editor; however, I don't need to know the yes / no part (don't want it in my database). I'm simply using this question/answer field to determine whether to unhide the rest of the questions. What would be the best recommendations to do this and still be able to have the Javascript see what the user selects so the hide/show functionality will work?
I've been succesful in getting the drop down to appear with the yes no using a custom function; however, i can't get the javascript to see what the selection is due to it being custom.
Any help with this would be great.
thanks

C
cgphp 11/23/2011

In the Query tab, set one of the field as alias:
SELECT

field_1,

field_2,

field_3,

field_4,

field_5,

field_5 as yes_no_dropdown

FROM table_name
In the Fields tab, enable the yes_no_dropdown only for add and edit pages.
In the Visual Editor set the yes_no_dropdown as "Lookup wizard". Choose the "List of values" option to enter manually the values.

W
wildwally author 11/23/2011

I thought of using this as a solution prior to asking; however, I don't want a bunch of nonvalue added fields in my database. Thinking I might not have understood the capabilities of PHP Runner I tried what you suggested; however, I received an error because I used the same field with different alias.
Source: Microsoft OLE DB Provider for SQL Server

Description: Column name 'field4link' appears more than once in the result column list.
Is there a way to get around this that I'm not aware of?
I've used the field4link on the add page 3 times all with a different alias. The other fields in the add page are all being used and serve data collection purpose.

C
cgphp 11/23/2011

You don't need new non-values fields in the database, you are using aliases. Post the sql code.

W
wildwally author 11/23/2011

There is no SQL code to post. I get the error when i click the Save button on the Add page.
And in the event section of the Add page nothing refers to the field4link datapoint.

C
cgphp 11/23/2011

Could you post the SQL code in the Query tab ?

W
wildwally author 11/23/2011

SELECT

AEID,

QRID,

AEEngineer,

JobStatus,

AttachQuestion,

Drawings,

AEAttachment,

SystemTypes,

Reclaim,

ControllerType,

RequestedDueDate,

Ref_Label,

DateCreated,

DateAccepted,

RTransferDate,

OrigAEEngineer,

QRID_Num,

ControlType,

MonitoringType,

field4link AS link,

field4link AS AEDropdown,

field4link AS EngSpecial

FROM dbo.AE

C
cgphp 11/23/2011

I don't see the field4link field in the query. I see only the aliases for that field. Your query should be:

SELECT

AEID,

QRID,

AEEngineer,

JobStatus,

AttachQuestion,

Drawings,

AEAttachment,

SystemTypes,

Reclaim,

ControllerType,

RequestedDueDate,

Ref_Label,

DateCreated,

DateAccepted,

RTransferDate,

OrigAEEngineer,

QRID_Num,

ControlType,

MonitoringType,

field4link,

field4link AS link,

field4link AS AEDropdown,

field4link AS EngSpecial

FROM dbo.AE



You have to unset the aliases before saving the record. Enter this code in the "Before record added" event before the return statement:

unset($values['link']);

unset($values['AEDropdown']);

unset($values['EngSpecial']);