Error when clicking Add-button in CRUD - atk4

When a form or an add-button returns to a page, it throws an error or shows wrong output on the page, if there is js or other kinds of output on the page. Here is an example:
$tabs->addTab('Skoler')->add('CRUD')->setModel('School');
$crud=$tabs->addTab('Elever')->add('CRUD');
$crud->setModel($student);
if($crud->grid){
$crud->grid->addButton('addStudents')->set('Importer elever')->js('click',$this->js()->univ()
->dialogURL('Importer elever',$this->api->url('importusers&usertype=student'))
->execute());;
$crud->grid->js(true)->addClass('reloadstudent');
$crud->grid->js('.reloadstudent')->reload();
}
When clicking on "Add School" This outputs
$('#barometeradmin_mgr').univ().dialogURL('Importer elever','/redskab/barometer/admin/?page=importusers\x26usertype=student\x26barometeradmin_mgr_tabs_view_htmlelement_crud_virtualpage=add')
in the dialogurl created by the button.
Is there a way to check if the page is loaded for the second time (that is, by the button).
Thanks!
Jeppe

I think all you need to do is leave out the '->execute()'?

Related

How to retrieve data from different page angular

I have a button in the table in the first page. When I click on the button, I want to save the panel Id and display on the next page. How can I call the data in angular? I'm desperately seeking for help since I'm stuck in there for almost a week now.
These are the images for my problem.
enter image description here
So this one is the first page, where there are buttons in each row.
After clicking Assign, it should show readonly data of ship name and panel name.
enter image description here
Regarding your issue, you should get the panel_id from params in the URL.
E.g.
In the routing of the assigning page, you just set the path:
{
path: 'assigning/:id',
component: <YourComponent>
}
So you can get the panel_id by using ActivatedRoute.
On click event of "Assign" button, you can pass the value to the ts component. In the ts file you can pass it via URL route as a parameter to the next page or store it in localStorage and read from the next page.
<button (click)="passValue(value)">Assign</button>

Selenium Web driver - Button is getting clicked but the next processing is not happening

My HTML code for a NEXT button which I am trying to click is:
<input type="submit" name="ctl00$ctl00$MainContent$ChildContent1$btnStep2_Submit" value="Next" onclick="waitBtn(event,'df_step2');
OverlayProgressPanel_NoSub('ctl00_ctl00_MainContent_ChildContent1_fsLoanData','ctl00_ctl00_upProgress');
" id="ctl00_ctl00_MainContent_ChildContent1_btnStep2_Submit" class="btn" onmouseover="hov(this,'btn btnhov');" onmouseout="hov(this,'btn')" />
Am using the below code to click that next button:
xpath = ".//*[#id='ctl00_ctl00_MainContent_ChildContent1_btnStep2_Submit' and #type='submit']"; // Next Button
Function_Classes.field_click(driver,xpath); // Click on Next button
driver.manage().timeouts().implicitlyWait(20,TimeUnit.SECONDS);
But,it looks like the button is getting clicked but not going to the next page where there is one more NEXT button
I am getting below exception :
Unable to locate element: {"method":"xpath","selector":".//*[#id='ctl00_ctl00_MainContent_ChildContent1_btnStep3_Submit' and #type='submit']"}
ctl00_ctl00_MainContent_ChildContent1_btnStep3_Submit = this is the button on the next page and since I am not getting the next page on clicking the first NEXT button ,I would think that might be the reason..
Can you please help me here?
IDs by HTML standards should be unique on the page so you shouldn't need to specify anything other than the ID in the locator. That will simplify your locators. So, in this case you can use By.id().
You've added an implicit wait in the middle of your script. That leads me to believe that you don't understand how implicit waits work. An implicit wait is set once for the driver instance and lasts the life of the driver. Generally you would put this statement near the top of your script. I would advise against using implicit waits and instead prefer explicit waits (WebDriverWait). I've rewritten the code. I think the below should work.
By next2Locator = By.id("ctl00_ctl00_MainContent_ChildContent1_btnStep2_Submit");
By next3Locator = By.id("ctl00_ctl00_MainContent_ChildContent1_btnStep3_Submit");
driver.findElement(next2Locator).click();
new WebDriverWait(driver, 10).until(ExpectedConditions.visibilityOfElementLocated(next3Locator)).click();
Suggestion: Don't overcomplicate your code by adding wrapper functions around .click(), etc. There's really no need for it. It makes your code harder to read and introduces unnecessary complexity. Keep it as simple as you can.
There is a problem inside your html, Because Threre are few functions are available inside your html, and you didn't call all functions properly. so your button click event was not fire. functions name like this waitBtn, hov.
See image for more details.

Oracle ADF: java.lang.IllegalArgumentException when pressing Printable page behaviour 12c

Hello am developing a web application using Oracle ADF and jdev12c. I have a page like below.
The above page is created using a template. That contains three parts. First part is image, second part is deck with more than one panel group layout (Here deck child value is decided using a value from managed bean of scope session.)and third part is actual content facet in this I have dropped a task-flow(bouded) as a region contain .jsff pages.
My problem is every thing is working fine. af:showPrintableBehavior is not working. When I click on the Printable view button am getting the following exception. After the following exception nothing is working in my application. (If I click on any commndLink it is opening in another tab and repeatedly trying to generate the page content for example the table but not displaying the content)
exception
java.lang.IllegalArgumentException
org.apache.myfaces.trinidad.model.RowKeySetTreeImpl.setCollectionModel(RowKeySetTreeImpl.java:315)
org.apache.myfaces.trinidad.component.UIXListView$RowKeyFacesBeanWrapper.getProperty(UIXListView.java:300)
org.apache.myfaces.trinidad.component.FacesBeanWrapper.getProperty(FacesBeanWrapper.java:61)
oracle.adf.view.rich.component.rich.data.RichListView$ListViewBeanWrapper.getProperty(RichListView.java:178)
org.apache.myfaces.trinidad.component.UIXComponentBase.getProperty(UIXComponentBase.java:1912)
org.apache.myfaces.trinidad.component.UIXListView.getSelectedRowKeys(UIXListView.java:451)
org.apache.myfaces.trinidad.component.UIXListView.postCreateCollectionModel(UIXListView.java:157)
org.apache.myfaces.trinidad.component.UIXCollection.getCollectionModel(UIXCollection.java:1671)
org.apache.myfaces.trinidad.component.UIXCollection.getCollectionModel(UIXCollection.java:1255)
org.apache.myfaces.trinidad.component.UIXCollection.getRowKey(UIXCollection.java:493)
oracle.adf.view.rich.component.rich.data.RichListView.visitChildren(RichListView.java:103)
org.apache.myfaces.trinidad.component.UIXComponent.visitChildren(UIXComponent.java:774)
org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:631)
org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:405)
org.apache.myfaces.trinidad.component.UIXComponent.visitAllChildren(UIXComponent.java:504)
org.apache.myfaces.trinidad.component.UIXComponent.visitChildren(UIXComponent.java:482)
org.apache.myfaces.trinidad.component.UIXComponent.visitChildren(UIXComponent.java:774)
org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:631)
org.apache.myfaces.trinidad.component.UIXComponent.visitTree(UIXComponent.java:405)
org.apache.myfaces.trinidad.component.UIXComponent.visitAllChildren(UIXComponent.java:504)
This is not working in only this page. I have tested this in one empty page that is created without using this template. In that empty page I have created this table and tried with af:showPrintableBehavior and here this behaviour is working fine.
Please help me. How to remove the above exception. Export to excel is working fine.
Thanks in advance.
Try using a clientListener inside the button that prints the page, then stop the event from propagating further:
<af:resource type="javascript">
/**
* Shows a popup from an "action" type event.
* #param {AdfActionEvent} actionEvent the event being handled
*/
function stopEventFromPropagating(actionEvent)
{
actionEvent.cancel();
}
</af:resource>
<af:commandButton text="Click Me">
<af:clientListener type="action" method="stopEventFromPropagating"/>
</af:commandButton>

Drupal Webform - How to load values from form, filled in a previous page

Working on Drupal, I have a page with a form made with "Webform" module, containing several fields (text fields and sliders) and a "Submit" button.
When the user enters the information and presses the "Submit" button, another page is loaded with custom code into it.
The new page is devided into 2 parts - the first one contains new information(based on the user input from the previous page); the second one contains (block) the same form, used in the previous page.
Is there a way to load the values, filled in the form from the first page into the new page?
First of all you would need to make a custom module, with the help of
hook_form_alter
You would need to store the previous form's information in cookies with prefix
Drupal_visitor_
and then display it in the new page like:
$form['submitted']['FirstName']['#default_value'] =
$_COOKIE[$firstname];
Thanks

Grails: save to Database without page reloading

How can i save the textfields and checkboxes to the DB without reloading the page?
Just to click on the button and then its in the DB. Nothing more. I don't get it. This means when I have a textfield where I type in a content -> then click the button, the content from the textfield should be in the DB and should do nothing more (not reloading the page, or go to top for example).
I don't get it.
EDIT:
When I have a a <div> tag with the id="testid" in the standard create.gsp:
def create() {
def mytestInstance = new Mytest(params)
}
and the <g:remoteLink> which should save this part looks like:
<g:remoteLink class="button" name="myForm" update="testid"
url="[controller:'mytest', action: 'create']" value="....." />
That does not work because the page is refreshing or something like this and the things are not stored in the DB, plus they are not in the textfields any more.
Use <g:formRemote> or <g:submitToRemote> to do the form submission with an Ajax call.
You should be able to use the formRemote tag to send the data to a controller via Ajax
Edit
As it says on that page;
This tag also requires the use of either the <g:javascript/>(link) or <g:setProvider/>(link) tags. See the AJAX section of the user guide to find out more.
Have you done that?

Resources