I need to show a Confirm message when the value Hiring is selected in the dropdown. How can I do that?
if (Status.SelectedValue == "HIRING")
{
Status.Attributes.Add("onChange", "javascript:return DisplayConfirmation();");
}
I have the function DisplayConfirmation in aspx page. This does not work.
Alter the DisplayConfirmation() javascript function to include a parameter for the selected value, and handle the logic inside the function.
In the Code behind, replace your code with this:
Status.Attributes.Add("OnChange", string.Format("DisplayConfirmation('{0}');", Status.SelectedValue));
So, you can change your javascript to be
function DisplayConfirmation(Status) {
if(Status == "HIRING")
{
if (confirm('Are you sure you want to do this?')) { __doPostback('Status', ''); }
}}
Related
Initially I setted the text as list in use-state and it change to grid when I click on it.How to show the list again when I click?
const [buttonText, setButtonText] = useState('List');
function handleClick() {
setButtonText('Grid');
};
This is the use-state and the function that changes the text.Can anyone help me ?
You can call same method and use ternary operator (check your current state and setState according to it).
function handleClick() {
setButtonText(buttonText == 'Grid' ? 'List' : 'Grid');
};
I have a pie chart on my dashboard, using click action, I menaged to show a report that has one fixed parameter. Here is my JS function on click action:
function showreport(scene) {
var newWindow;
if(scene.getCategory()=='POS'){
newWindow=window.open("url_report?type_lm=POS", 'REPORT');
}else{
newWindow=window.open("url_report?type_lm=NEG", 'REPORT');
}
}
This one works fine.
But now I want to pass a dynamic parameter too ( the variable obtained with query component, it is stocked in result var (code_lm):
Here is what I did:
function showreport(scene) {
var newWindow;
var code_lm=this.dashboard.getParameterValue('code_lm');
if(scene.getCategory()=='POS'){
newWindow=window.open("url_report?type_lm=POS&code="+code_lm, 'REPORT');
}else{
newWindow=window.open("url_report?type_lm=NEG&code="+code_lm, 'REPORT');
}
}
This one doesn't work, nothing is displayed by clicking the chart. I found this line var code_lm=this.dashboard.getParameterValue('code_lm'); causes the prob.
However, I do the same thing with button component :
function showreport() {
var code_lm=this.dashboard.getParameterValue('code_lm');
var newWindow = window.open("url_report?code=" + code_lm,'REPORT');
}
and it works perfectly so I wonder why this.dashboard.getParameterValue() is not working in some cases.
Can anyone tell me where comes from the problem ?
yes, if you want to pass value of parameter from query component then you need set parameter value by writing bellow code in post fetch of query component.
function fun(code_lm) {
dashboard.setParam('yourParamName',code_lm.resultset);
}
check out this may help you. How to pass a variable obtained from query component into a query on Pentaho CDE? may help you.
In my application toolbar I want to show a back button when the user is on /manage/*. If a user is on /manage or /other the back button should not show.
Here's my computed property to return true:false if the user is on /manage/*
computed: {
showBackButton: function() {
return this.$route.path === "/manage/*";
}
}
The wildcards in the regex documentation on the vue-router site do not seem the work. According to the documentation, * is the correct wildcard to use.
Your code is making a type and value comparison, javascript does not work with regex by default... If you want to work with regex, I would rather try something like:
computed: {
showBackButton: function() {
return this.$route.path.match(/^\/manage\/.*$/);
}
}
Is it possible to locate an element altho it is hidden? I want a function that looks for my tooltip that says something was not filled correctly in my form.
the function looks like this:
public function checkTooltip()
{
$element = $this->byClassName('tooltip');
if ($element->displayed())
{
echo "something was not filled correctly";
}
}
$var1->value('hello');
$this->checkTooltip();
$var2->value('world');
$this->checkTooltip();
$var3->value('!');
$this->checkTooltip();
This works perfectly when the tooltip appears but if there is nothing wrong I get the message:
"PHPUnit_Extensions_Selenium2TestCase_WebDriverException: no such element"
And this make sence because it's hidden when nothing is going wrong but I want to select that element anyways, becouse I want my test to make sure that it's not vissible during my test to make sure everything is okey.So is there a way to select a hidden element using phpunit_Selenium2TestCase?
This worked as a charm!
public function checkError()
{
$tooltip = $this->elements($this->using('css selector')->value('div.active div.invalid'));
if(count($tooltip) != 0)
{
foreach ($tooltip as $tool)
{
$warning = $tool->text();
echo "You got a invalid tooltip with this message '".$warning."'";
}
}
}
I am trying to do something like : when user click on the button, the child panel will show/hide
the issue is the 'onbtnClick' function is working just once. when i click on the button the panel shows and then when i click it again nothing happens and no errors tho ! the panel should hide
By the looks of it, there isn't really much need to pass a boolean param to the function.
If you purely want a 'toggle' function, based on the panels visibility and you have a reference to the Ext component, you can use the isVisible() function:
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.panel.Panel-method-isVisible
So your onBtnClick function would look something like this:
onbtnClick: function (){
var childPanel = Ext.getCmp('p');
if(childPanel.isVisible()) {
childPanel.hide();
}
else {
childPanel.show();
}
}
onbtnClick: function (){
var childPanel = Ext.getCmp('p');
if (!childPanel.isHidden()) {
childPanel.hide();
} else {
childPanel.show();
}
}
Instead isVisible() use method isHidden() because method isVisible may return false when the panel is covered by other components or is not rendered yet (even when your panel has not got hidden property (hidden = false)).
panel.getEl().toggle();
will serve your purpose.
-YP
you have setVisible, taking a boolean parameter to know what to do.
childPanel.setVisible( ! childPanel.isVisible() )
This example will actually toggle the visibility at each execution.