This topic is locked
[SOLVED]

 Unable to Combine first middle last name and save into f

5/31/2011 12:44:27 AM
PHPRunner General questions
M
MightyRunner author

Hi, I searched/applied/tried for 2 days but failed. I have first, middle, last and full fields .

on visual editor / custom I can get "full" name with $value = $data["first"]." ".$data["middle"]." ".$data["last"];

but this work to show only but does not save it in DB so its unavailable in pull-down look-up field also.

in phpmyadmin sql this following work perfect also to get the full name

SELECT CONCAT(

FIRST , ' ', middle, ' ', last )

FULL FROM users

But same code still wont work in phprunner I tried it in custom view and before record add etc.

I will really appreciate if someone can provide exact code and where to put it. at visual editor/ field or events etc

Thanks for your time on this question

C
chaintm 5/31/2011

PhP runner doesn't have fully customizable pulldowns. to do so you need to add a snippet from the editor then goto the event , so if you put it in a list page goto list events for that table.

*PLEASE NOTE**

This is for build 5.2 and earlier,

using the latest build the value [a] from my understanding has changed also buttons work on java preloads now, so its all changed. I have not upgraded to the new version because the very fundimentals of how the backend works has changed, leaving customization I have done (tons of it) absolete. You could however use the following and whatever the new value of [a] is, just change to that value.

From there you can add the following for a pulldown, Please note you will have to modify for your needs. I added //notations for your understanding.
/////////////////BUTTON////////////



//building your $str value

$str = "";

//This is your pulldown build, here we name the pulldown values that are static, show all is part of the built in showall statement of php runner.

$str.= "<select onchange=\"window.location.href=this.options[this.selectedIndex].value;\"><option value=\"\">Categories</option>";

//for whatever page you are doing this pulldown in, use that page url below inplace of what I have, this is for the showall statement option.

$str.="<option value='order_sales_item_list_list.php?a=showall'>Show all</option>";

//going global to call a value from a table

global $conn;

//for me, the items_cat_menu is a table I made in mysql that refers to values that = names, for instances itemcatid=1,itemcatname=concessions,itemcatnum=1,itemcatsub=1... i use these variables to refer to other tables and on and on it goes.

$strSQL = "select * from items_cat_menu";

$rs = db_query($strSQL,$conn);

// the while statement here is key, to build a pulldown tree you need to read all related data

while ($data = db_fetch_array($rs))

//because of the while statement, the $data["ItemCatID"]and $data["ItemCatName"] as you can see below. will repeat in my table, my itemcatid is a number value and the name is for naming. Now you can do the same by adding all the values for your first ,middle, last then making it one main value if you like, that really is up to you, allot of ways you can make that.

$str.="<option value=\"order_sales_item_list_list.php?ctlSearchFor=&srchOptShowStatus=1&ctrlTypeComboStatus=0&srchWinShowStatus=0&a=integrated&id=1&criteria=and&type1=&value11=".$data["ItemCatID"]."&field1=ItemCatID&option1=Equals&not1=\">

".$data["ItemCatName"]."</option>";

$str.="</select>";

echo $str;


Because builds have change drastically sense 5.2, in my 5.2 current project (5.2 build 5482 to be percise) I also use the following to nulify issues of searches over-riding my pulldowns or custom searches... IE...
/////////////////list page: before process////////////



if (@$_REQUEST["a"] && @$_REQUEST["a"]!="delete" && @$_REQUEST["a"]!="search" && @$_REQUEST["a"]!="advsearch" && @$_REQUEST["a"]!="showall")

{

$arr = explode(",",$_REQUEST["a"]);

if (count($arr)>1)

{

}


Finally if I make custom buttons to do other things such as a customized cancel button (why? Because I need it to do del as well)... then I do the following...



if (@$_REQUEST["a"]=="cancel")
{

global $conn;

$str5 = "select Order_status from order_sales where Order_num =".$_SESSION[$strTableName."_masterkey1"];

$rs5 = db_query($str5,$conn);

$data5 = db_fetch_array($rs5);
if ($data5["Order_status"]!=2)
{

global $conn;

$str = "select Order_num from order_items where Order_num =".$_SESSION[$strTableName."_masterkey1"];

$rs = CustomQuery($str);

while($data = db_fetch_array($rs))

{

//remove detail records for selected master record

$strDelete = "delete from order_items where Order_num =".$_SESSION[$strTableName."_masterkey1"];

db_exec($strDelete,$conn);

}

global $conn;

$str = "select Order_ID from event_times where Order_ID =".$_SESSION[$strTableName."_masterkey1"];

$rs = CustomQuery($str);

while($data = db_fetch_array($rs))

{

//remove detail records for selected master record

$strDelete = "delete from event_times where Order_ID =".$_SESSION[$strTableName."_masterkey1"];

db_exec($strDelete,$conn);

}

global $conn;

$str = "select Order_num from order_sales where Order_num =".$_SESSION[$strTableName."_masterkey1"];

$rs = CustomQuery($str);

while($data = db_fetch_array($rs))

{

//remove detail records for selected master record

$strDelete = "delete from order_sales where Order_num =".$_SESSION[$strTableName."_masterkey1"];

db_exec($strDelete,$conn);

}

echo "<script>alert('You Have Cancelled the Order')</script>";

echo "<script>window.location.href='order_sales_list.php?a=return';</script>";

//header("Location: order_sales_list.php?a=return");

exit();

}

else

{

echo "Unable to delete this invoice, invoice has been previously processed";

}
}
else


Conclude:
If you need all 2 type of interactions on a page make sure to do them in the right order, IE as I pasted the code, it would be last 2nd. basilcy go in reverse in which i posted, so custom buttons code first, then request explode 2nd and the pulldown last. Eh hope this helps you out, there is no simple solution, (never is)< phprunner is a great tool for getting the simple things done, but when it comes to fully customizing all possible scenarios, I don't know an editor out there that could cover all bases, this is by far the best, thou I do argue that any build past 5.2 just becomes a pain. hehe but that's personal preferance at this point. GL!

M
MightyRunner author 5/31/2011

Thanks very much for your reply and code will come handy on other parts. but am using 5.3 demo and I have no problem to join & view full name in list or view by putting $value = $data["First"]." ".$data["Middle"]." ".$data["Last"]; in view/custom. but problem is its view only does not get saved and text wont show-up in lookup table field. though i think clicking on blank space still insert data.

if I insert the sane code in edit as field then I get the error Undefined variable: data

I have tried to look for java script or php code but so far found nothing.

I don't mind if its internal or external code or script.

C
chaintm 6/1/2011



Thanks very much for your reply and code will come handy on other parts. but am using 5.3 demo and I have no problem to join & view full name in list or view by putting $value = $data["First"]." ".$data["Middle"]." ".$data["Last"]; in view/custom. but problem is its view only does not get saved and text wont show-up in lookup table field. though i think clicking on blank space still insert data.

if I insert the sane code in edit as field then I get the error Undefined variable: data

I have tried to look for java script or php code but so far found nothing.

I don't mind if its internal or external code or script.


Well from what I am reading here, you want to do what I mentioned above, this allows you to display and basicly fully control the page without interacting with phprunner. You again are basicly changing the URL address. I will edit the above because I noticed I didn't say what was the button part and not. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=58653&image=1&table=forumreplies' class='bbc_emoticon' alt=';)' /> ops! as far as the rest or if this is not what you need, I am kinda lost at what is happening sense you are a 5.3 build. I know the devs don't support custom coding , but they should be able to at least say ...
"well your issue is that the way our system works you need to bla"...
Hope someone see's this and can shed some light on it.

M
MightyRunner author 6/1/2011

I simply made full name to another field "indentify as or fullname" where user can fill desired full name or nick