If I'm following you on this, there are two solutions:
Deside where your id will come from, a recorset, a session, or a "entered value" (a fixed value)
The first is the most typical, your insert statement needs a value assigned to it:
- so there needs to be a hidden feild in your form that echoes the id from the record set,
- an entered value (your own value) in the insert statement
both can be done through the wizard or under the server behaviors tab by clicking on "insert record, than "feilds tab"
The second is you can edit your code directly:
Both types of insert statements have very easy to spot code lines that can be edited easily - take a look
- If you are using ADDT its : $ins_contacts->addColumn("userid", "STRING_TYPE", "POST", "myform_id"); ..but use your form names.
- If you are using DW its : GetSQLValueString($_POST['myform_id'], "text"),
Both you can replace the form value with an "entered value" Ex: GetSQLValueString('my string of text', "text"),
Basicly the short of it is, that you need to tell the insert record, through the wizard or the code, where the data is coming from (form or string) and where is the data going ( what table, what column)...the table part is already handled... so the code above says what column.
I hope I understood your delima, sorry in advance if I missed it completely.
Thanks for your detailed reply, there are a couple things that don't apply.
When creating an editable drop-down, the steps are.
1. Create a recordset so it shows all the items in the drop down list.
2. Create the editablility through the form it supplies.
Here we only have a few options.
- The defined recordset
- Get Labels
- Get Values
- Show Add Button
- Default Value...
Those are the items only of value. So basically I believe what I need in short is, When somone clicks the ADD NEW button, it needs to be able to apply that hidden valueid
So once you do that, there is only the INSERT transaction for the entire form, not for the specific drop-down list "ADD" feature.
Sorry I didn't explain better before, I hope this helps.
Ok I completely misunderstood. Sorry for the confusion. I'm afraid I may not be much help on this particular function. Some functions I've really torn apart and modified, this is not one of them.
This does not look like one of the more simple functions to change unlike some others,
Before trying to go into lengthy info on how to break it down, is there any chance the info you are trying to update is some type of default name or incremental name, something than can be hard coded? ..or is it unique like a visitor, so you are pulling down each time? Ex: User1, user2 vs. sally101, david2009, etc.
IF not, there are a several lines of variable setting and function modification to change at first glance.
I can look into later, but the variables are not even in the same insert function page.
Here is the Key line in WDG_recordsetInsert.php,
$sql = 'INSERT INTO ' . $vars['table'] . ' (' . KT_escapeFieldName($vars['updatefield']) . ') VALUES (' . KT_escapeForSql($text, 'STRING_TYPE') . ')';
but the vars appear to come out of an array in 'WDG_functions.inc.php : here is the function variables being set for the insert function above
$WDG_sessInsTest = &$_SESSION['WDG_sessInsTest'];
$WDG_sessInsTest = array(
'conn' => $connectionName,
'rsName' => $rsName,
'table' => $sqlTable,
'idfield' => $idField,
'updatefield' => $updateField );
This array (at first glance) could be modified, but I can't promise that the vars will carry through because I don't see exactly where this array is being used again.
As I mentioned, if the values you need are something you could hard code and increment, you could easily modify the 'insert to' function above.
I would also toy around with some $_POST data and Session data vars and see if you can drop those straight into the sql statement above.
Sorry I can't be more help on this one.
Hey Thanks, you know I didn't think about actually modifying the actual SQL query, I didn't clue in at 2am last night. But it worked out, used some $_SESSION variables and was able to jimmy it to work.
Thanks for the direction mate!
That’s great...thanks for the update. I have found that a lot of times its easier to go around the functions than to modify every single one. You have to pick your battles but ADDT does have great toys when you need good stuff on the fly.