Here I have a case where I want to make a column to be editable by choosing value through drop-down only so user is not able to edit it manually by typing anything.
Do you have any solution for this by using PHPExcel?
Thanks anyway.
I have accomplish this task by using following code.
$objValidation = $objPHPExcel->getActiveSheet()->getCell('B'.$i)->getDataValidation();
$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_LIST );
$objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_INFORMATION );
$objValidation->setAllowBlank(false);
$objValidation->setShowInputMessage(true);
$objValidation->setShowErrorMessage(true);
$objValidation->setShowDropDown(true);
$objValidation->setErrorTitle('Input error');
$objValidation->setError('Value is not in list.');
$objValidation->setPromptTitle('Pick from list');
$objValidation->setPrompt('Please pick a value from the drop-down list.');
$objValidation->setFormula1('"Rate,Margin"');
Related
Hypothetical:
Say i'm having someone order a cake and they choose vanilla or chocolate, and then they have to choose a frosting
if vanilla: strawberry or buttercream
if chocolate: mocha, dark chocolate or buttercream.
Right now the frosting value in the data model can accept all four options, so all four show up in the dropdown.
a) is there a way to change the binding for the second dropdown after the first is chosen?
This can be done without having the data saved in any datasource. Simply do the following...
Suppose the first dropdown is named primaryDropdown and the second dropdown is called secondaryDropdown. In the primaryDropdown options set the following:
["Vanilla", "Chocolate"]
Also, make sure to uncheck the option allowNull and on the onAttach event handler, place the following:
widget.value = "Vanilla";
Now we move on to the secondaryDropdown. Here, we will do a binding so place the following in the options value:
getAvailableOpts(#widget.root.descendants.primaryDropdown.value)
In the client script, we need to make sure that function exists so please paste the following in any client script:
function getAvailableOpts(primaryValue){
var options;
switch(primaryValue){
case "Vanilla":
options =["Strawberry","Buttercream"];
break;
case "Chocolate":
options = ["Mocha","Dark Chocolate","Buttercream"];
break;
default:
options = [];
}
return options;
}
From here, you are good; However we can still make it better. For that, make sure to also uncheck the allowNull option for the secondaryDropdown and then we need to add some logic in the onValueChange event handler of the primaryDropdown.
widget.root.descendants.secondaryDropdown.value = widget.root.descendants.secondaryDropdown.options[0];
References:
https://developers.google.com/appmaker/ui/input-widgets#dropdown
https://developers.google.com/appmaker/ui/binding#bindings
https://developers.google.com/appmaker/scripting/client#use_scripts_in_binding_expressions
Im guessing you set the dropdown "possible value" options in the data source and you have those fields as just string fields in your table.
the quick and dirty way to do this is go to the Cake drop down and on the Property Editor>Events>OnValueChange select Custom Action and use this Code
if(widget.value==="Vanilla"){
widget.root.descendants.Field.options = ['Strawberry','Buttercream'];
}else if (widget.value === "Chocolate"){
widget.root.descendants.Field.options = ['Mocha','Dark Chocolate','Buttercream'];
}
"Field" here is replaced with the name of the dropdown box for your frostings
also go to the property editor of the frostings dropdown and delete everything in the options field there.
I was trying to solve for a similar situation and created an additional table to serve as a lookup.
I have a drop down for CATEGORY with possible options set on the field in the main data source.
Then I have a second table with 2 Columns: CATEGORY, and SUB_CATEGORY.
On the entry form I have options for the SUB_CATEGORY drop down set to SUB_CATEGORY on the CATEGORY_MATRIX lookup table.
Then for an onValueEdit event on the CATEOGRY drop down I have a script to reload the CATEGORY_MATRIX table source based on the value of the CATEGORY drop down in the query so when the CATEGORY is selected only valid SUB_CATEGORY options are shown in the second drop down.
var datasource = app.datasources.CATEGORY_MATRIX
datasource.query.filters.CATEGORY._equals = newValue;
datasource.load();
There may be more efficient ways to do this but the benefit is I could create another form page and dynamically add new combos so there isn't any required code change as new combos are needed.
I am about porting an Extention from T3-6.2 to T3-7.6+
public function processDatamap_preProcessFieldArray(
&$fieldArray, $table, $id,
\TYPO3\CMS\Core\DataHandling\DataHandler &$pObj
) {
// t3_origuid is set? Yes, ist a Copy
if(isset($fieldArray['t3_origuid']) && $table=='mytable') {
$fieldArray['field1']++;
$fieldArray['filed2']--;
}
}
BUT:
To tell if it is a copy or not this needs the field 't3_origuid' in my record. It is not a standard field but if present it is filled by typo3.
Where does this filed come from? My I use this witout further problems?
If you know a hook/better way, (Slot, Signal?) to use in this case in T3 7.6+ please let me know.
Thanks a lot,
Christian.
This field is used by the sys extension workspace. If you change a tt_content element inside a workspace the original uid will be stored inside the field. So the changes,when they will be published, can be applied to the original element.
I created a form with a single data source: InventJournalTable.
I also added a grid on it and two field from the data source : JournalType and JournalId
The ActionPane has a button and in its clicked event handler I am trying to do the following:
1. add a new data source and join it with the current one on JournalId
2. add to fields from the newly added data source to the current Grid.
This is what I have until now ... just for testing.. I have tried to access data source and add a range. It works nice, maybe the join is working too, but how can I add those two fields?
void clicked()
{
Query query;
QueryBuildDataSource qbdsInventJournalTable;
QueryBuildDataSource qbdsvwInventJournals;
super();
query = InventJournalTable_ds.query();
qbdsInventJournalTable = query.dataSourceTable(tableNum(InventJournalTable));
qbdsInventJournalTable.addRange(fieldNum(InventJournalTable, JournalType)).value(queryValue(InventJournalType::LossProfit));
qbdsvwInventJournals = qbdsInventJournalTable.addDataSource(tableNum(vwInventAdjJrnlCostAmount));
qbdsvwInventJournals.addLink(fieldNum(InventJournalTable, JournalId), fieldNum(vwInventAdjJrnlCostAmount, JournalId));
qbdsvwInventJournals.joinMode(JoinMode::OuterJoin);
//gridOverview.addDataField(
InventJournalTable_ds.executeQuery();
}
One more thing, I plan to add another button named "Remove details" which will remove the second data source and the grid should return to its initial state.
Am I on the right track at least? Can I get some hints about this?
Instead of dynamically adding the datasource/fields/etc have you considered just adding them on the form, but disabling the joined datasource until you need it? Seems to me like a simpler/cleaner solution.
See here:
http://olondono.blogspot.com/2008/06/how-to-enable-or-disable-joined.html
In a customised form I would have a create Purchase Menubutton which opens a dialog to create a purchase order.
But I need to select few records like one or two lines and then create purchase order only for those records. How do I do that?
Take a look on the "Create purchase order" button on the SalesTable form.
It works differently: you select the lines to purchase after you press the button, but it might work in your case also.
Also have a look on how to use multiple selected records in a grid.
Here is a piece of code which allows you to get the record from the previous form.
You have to put this piece of code in the INIT method of the dialog. So you have to override the init of the dialog.
DmoVehicleTable vehicleTable;
DmoVehicleId vehId;
// Get the vehicle ID from the previous form
if (element.args() && element.args().record())
{
switch (element.args().record().TableId)
{
case (tableNum(DmoVehicleTable)):
vehicleTable = element.args().record();
vehId = vehicleTable.VehicleId;
break;
default:
throw error (strFmt("#SYS477", this.name()));
}
}
I hope this will help you.
If you need more help: http://sirprogrammer.blogspot.com/
i have an confirm password field in the drupal and i need to set description for both the text boxes and i tried this.
$form['pass[pass1]']['#description'] = 'textbox1';
$form['pass[pass2]']['#description'] = 'textbox2';
is that possible . can any one please explain how to do it .
i tried this too.
$form['pass']['pass1']['#description'] = 'textbox1';
$form['pass']['pass2']['#description'] = 'textbox2';
for both code nothing changes in the gui
The password field gets split into two in the expand_password_confirm function (called pass1 and pass2 like you've got above so I guess you probably already know that). You can probably change the descriptions in a form pre render function, so in your form put:
$form['#pre_render'] = array('MYMODULE_my_form_pre_render');
And then create the following function:
function MYMODULE_my_form_pre_render(&$form) {
$form['pass']['pass1']['#description'] = 'textbox1';
$form['pass']['pass2']['#description'] = 'textbox2';
}
Hope that helps