Semantic UI model pop up on submit button - coffeescript

I am trying to show up a model pop up on submit button. So when ever the submit button is clicked a model will show up with yes or no if no so it will dismiss the model and on yes it will submit the form!
By button and model code just have a header for now!
= f.submit 'Claim Job', class: "ui button primary job_claim" , onclick: 'Formspinner()'
.ui.basic.modal
.header wooo
my js is like simple:
window.Formspinner = ->
$('.ui.basic.modal')
.modal('show')
return
using coffee script and slim html!
every time I click submit it submits the button but no model pop up!
want to use sementic-ui basic model which covers the whole screen!
http://semantic-ui.com/modules/modal.html#basic

Related

How to make modal close after validation using Vue js?

I am using <q-modal>(Quasar Framework) for a form. On clicking Add button a form will pop over. In this, I am validating each form tags, after clicking submit button. To close the modal, I am using #click="$refs.maximizedModal.close()" for submit button.
Everything works fine. Now I need to retain modal if the validation is not returning true or if validation satisfies then the modal need to be closed.
Is there any method to do conditional submit in Vue js?
You should make a custom function for the submit of the form and use it, something like this :
....
methods{
checkForm(e){
if(VALIDATION_IS_TRUE){
//Validation has passed, we submit the form OR close the modal
$refs.maximizedModal.close(); // Maybe this.$refs.maximizedModal.close()
e.target.submit();
}else{
//The form is not validated, do something to inform the user
}
}
}
and instead of using the #click for the submit button, add this to the form element :
<form #submit.prevent='checkForm($event)'>
Hope this helps!

Onclick open new window and reload previous page

I trying to have a new window pop up to checkout at Paypal, OK. Problem is that if user goes back to add or take away items and click "checkout" again, the pop up does not work. The only solution I can think of is when customer submits form to check out, the action opens up a new window and reloads the page they were just on. Can this be done or is there another way?
checkoutPayment: ' {payment}',
paypal: '<form target="_blank" id="rcCartForm" action="https://www.paypal.com/cgi-bin/webscr;" method="post">' +

How to create a "New xxx" popup?

I have a Grid object and added a [ (+) New Client ] button which I'd like to open a popup form to create the new client with a couple fields.
I've looked at the code examples in the website but haven't found how to do it (sorry if I've missed something).
This is the current page code:
function page_clients_listing($p){
$g = $p->add('Grid');
$g->addColumn('text','first_name');
$g->addColumn('text','last_name');
$g->addColumn('inline','telephone');
$g->addColumn('expander','comments');
$g->setSource('client');
$g->addButton('With Icon')->set('Add New Client')->setIcon('Plus');
}
Thanks in advance!
You can either create a popup or a dialog. Dialog is based on jQuery UI dialog implementation. Popups are likely to be blocked and are harder to control.
This is actually working for any object (you can apply to view, button, image, icon, etc), but I'll use button).
$b=$g->addButton('Add New Client')->setIcon('Plus');
$b->js('click')->univ()->frameURL($title,$url);
// OR
$b->js('click')->univ()->dialogURL($title,$url);
$url would most likely be returned by api->getDestinationURL(). The other page would be loaded and scripts on that page will be evaluated. Let's say you are on other page and now need to close the window.
$result = $this->addButton('Close')->js('click')->univ()->closeDialog();
closeDialog() returns a jQuery chain object pointing to a view which originally opened the frame. As a result if you do $result->hide(); then after dialog is closed, the original button ('add new client') will also be hidden.
Here is example to show some additional things you can do with frames, reloading and custom event handlers:
http://agiletoolkit.org/example/refresh1

Submitting a form using Sencha Touch

I want to build a simple form with Sencha Touch, and attach a submit handler to it. Either I'm a n00b, or this is surprisingly hard to do. Here's what I want:
Attach an onSubmit handler to the form, not a onClick handler to the submit button
Cancel form submission when the form is submitted.
The problem is that regular Sencha Touch buttons are not buttons at all - they are just a bunch of divs and spans. Hence, tapping on the submit button doesn't fire the native form submit. As a result, a handler will need to be attached to the "button" to fire a submit on the form, and then capture the submit of the form to do what I want. This is doable, but doesn't sound elegant. Is there a better way of doing this?
The second problem is that of event canceling. How do I get a handle of the submit event object so that I can call preventDefault on it? Is there any other way to do this in the Sencha Touch world?
If you want to perform a stand submit action on a form, you need to set the "standardSubmit" config property to true, which will force a standard submit when the form is posted.
And yes, you must attach an event handler to a button but it' very easy. All you have to do is setup the button like so:
{
xtype: 'button',
text: 'Next',
handler: this.tapHandler //<= common tapHandler for the page
}
Then setup a handler like so:
// Toolbar button handler function
tapHandler: function (button, event) {
switch (button.text)
{
case "Submit":
myForm.submit({...config object see API...})
// to cancel event simply return false
return false;
break;
}
}
You have got an option "submitOnAction: true,", which lets you submit when user clicks button Ok/Go on the virtual keyboard on mobile device (works fine for iPhone/iPad).
app.views.newItemForm = Ext.extend(Ext.form.FormPanel, {
submitOnAction: true,
activeItem: 1,
...

Menu State - ASP.Net MVC

In my ASP.Net MVC View, I have a menu. The menu consists of a number of Parent Items, with Child Items (anchor tags) underneath.
I'm using JQuery to toggle the menu items opened and closed, as the user clicks on them.
Unfortunately, once the user clicks onto an anchor tag, and gets sent to another page, the menu state is lost, and the menus go back to being closed.
Now if this was "normal" ASP.Net I'd be sticking the menu state information into the ViewState, and storing the information that way.
Is it possible to do something similar in MVC?? This is the first MVC project that I've worked on, so go gentle with me!
So let me first make sure I understand you correctly.
The user will click on a menuitem, which will take him to another page. And when he gets to that page you want the menu to reflect the fact that he is on that page? Correct?
This doesn't sound too tricky. I assume the menu is a partial view - so you would render it something like this:
<div id="menu">
<% Html.RenderPartial("Menu"); %>
</div>
So the view will already know which menu item triggered it. For example, if the user clicks on Widgets->New, you might return the NewWidget.aspx view, and it will know that the Menu item to highlight is Widgets->New. So you simply use the overload for RenderPartial to specify the name or id of the menu item to highlight.
<div id="menu">
<% Html.RenderPartial("Menu", "newWidgetLink"); %>
</div>
If it is NOT the case that a view already knows which Menu Item to highlight, you will need to pass the id of the menu item with the link. So your link generation will look something like this:
Html.ActionLink("Menu Item Text",
"Controller name goes here",
"Action name goes here",
new { menuItem = "menuItemId goes here" },
null
)
Then your action will need to handle this parameter. Easiest would be to take the parameter and add it to the ViewData. The Menu will then check in the ViewData for the Id of the MenuItem to highlight.
Maybe this: ASP.NET MVC - Is there a way to simulate a ViewState?
http://blog.maartenballiauw.be/post/2009/10/08/Leveraging-ASPNET-MVC-2-futures-ViewState.aspx
http://forums.asp.net/t/1285163.aspx
and this might help too
http://webcache.googleusercontent.com/search?q=cache:y26JBxHjbBUJ:www.beansoftware.com/ASP.NET-Tutorials/Intro-ASP.NET-MVC.aspx+how+does+mvc+save+view+state&cd=8&hl=en&ct=clnk&gl=us
There are a lot of articles about view states in MVC and since you're new to this perhaps some pre-reading would be handy and may even answer your upcoming questions!
Good luck!