I have 2 nav-tabs , one of them shows the list of available items and the other tab gives a form where you can add the item details.
All the item details gets saved in database of submission of the form. If there is error the form submission fails and we send out 500 error code.
Now the problem is when i submit the form and the details are saved in database successfully i want to change the tab from Create to Edit.
Can anyone please tell me how can i achieve this?
Related
register form select user then automatically show user header id
how to get selected data in form before submit
how to check a condition selected user = header and get value in Django
view function work but how to get form data in before submit in template
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
Unable to click on button after entering the email address.
driver = new ChromeDriver();
driver.get("http://in.rediff.com/");
driver.findElement(By.xpath(".//*[#id='homewrapper']/div[5]/a[3]/div/u")).click();
driver.findElement(By.xpath(".//*[#id='wrapper']/div[2]/ul/li[2]/a")).click();
driver.findElement(By.xpath(".//*[#id='useremail']")).sendKeys("xyz");
driver.findElement(By.xpath(".//*[#id='emailsubmit']")).click();
I am supposed to see the password input box after the submit button click. For somereason I am not able to see this. Am I doing anything wrong? Not getting any errors after this line.
System.out.println("Finish");
This line is executed as well.
Your code is clicking on the Submit button perfectly.
As per the rediff functionality, if "xyz"(username) you are entering doesnt exist, then it will redirect to Login form.
So the reason you are not getting password object. Try with any existing user account(username).
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()'?
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?