A pop up window in ColdFusion - coldfusion-10

I need a simple pop up window for displaying a detail policies when users click on a link. So within texts there will be a link such as see detail here and when user click see detail here a pop up windows show up.
I know how to do it in javascript but this type of pop up nowadays looks so ancient and can be blocked by pop up blocker.
Can I use cfmessagebox? I have googled and got many examples but none is calling the cfmessagebox from a link.
Can anyone help?

according to the documentation
<script type="text/javascript">
function showMB(mbox) {
ColdFusion.MessageBox.show(mbox);
}
</script>
<cfform>
<p>Click a button display the corresponding message box.</p>
<cfinput name="Prompt" type="button" value="Prompt"
onclick="showMB('mymessagebox01')">
</cfform>
<!--- Code to define the message boxes. --->
<cfmessagebox name="mymessagebox01" type="prompt"
message="Write a short description about yourself"
labelOK="This is OK" labelCANCEL="Cancel this"
callbackhandler="showResult1" multiline="true"/>
form/button code can be rewritten into:
show
or
show

Related

Article open in modal window after a user click on facebook share link and come back to your site

I think I need your help here... On my site, I've done all the articles open in modal window by clicking on the link "read more" that exists in every article.
Also, each article has a button that shares this article on facebook.
But, when the user who will see my article on facebook, click this link to read the article, it come back to my page, but the article (logical) not open in modal window!!!
Is there any way, in the "return" of the user on my site, after having pressed the link of facebook, automatically open this article in modal window? Or, if the question above can't be done, is there any way by customizing the link I send to facebook, to set it in the "return" of the user to my site, after having pressed the facebook's link ofcourse, to show the article in intro view and not in full view?
Thank you very much for your time!
I'm using modal windows in my website and I utilize the following HTML code to open an article in a popup:
<a class="modal" rel="{handler: 'iframe', size: {x: 680, y: 370}}" href="yourarticleid=759&tmpl=component&task=preview">Open a link in modal</a>
The method above uses the native function for creating the modal window and calls the article you need to display. However, since Facebook formats all posted links I don't think you'll be able to include the crucial piece of code (below) that triggers the modal window.
class="modal" rel="{handler: 'iframe', size: {x: 680, y: 370}}"
Here is a kind of solution, an idea in other words, that make your articles open in modal window, after a user click on facebook share link and then come back to your site.
In my case I did this...
To open modal windows in my site, I am using the extension modalizer from nonumber.nl. This extension adds something like that &ml=1 at the end of article's url. The link that comes from facebook don't contain this &ml=1 at the end. So...
1. First of all, in to my article's content, I should include modal's behavior.
2. Then, I should make my code check if the url has this &ml=1 at the end or not.
3. After, I should decide what my code will do in those two cases. So, I want to do nothing if &ml=1 already exists and I want to open facebook's url in modal window if &ml=1 doesn't exist. I also want everytime that I close my modal window to load index.php, else user will see my article on frontend view.
Here is the code for all this:
<?php JHTML::_('behavior.modal');
$url= 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
if (strstr($url, "&ml=1")){/* Do nothing */}
else {?> <a class="modal" id="modalWindowLink" href="<?php echo $url ?>"></a>
<script>
window.addEvent('domready', function(){
window.addEvent('load', function(){ SqueezeBox.fromElement($('modalWindowLink')); });
});
SqueezeBox.addEvent('onClose', function(){ window.location = 'index.php'; });
</script>
}
<?php } ?>
If you have any better idea, or if you see something that could work better in other way, please let me know!!!

rails 3 - Add a Button that won't submit a form

I am trying to add a few "next" and "back" buttons to a form. The Idea is to divide the filling-out process into several steps and with these buttons, the div of the current step gets hidden and the next resp. previous step is displayed.
My Problem is that when I add buttons in the following way...
<button class="proceed_button" id="loan_information">Proceed</button>
<button class="cancel_button" id="loan_information">Cancel</button>
... they submit the form.
Is every button inside a form-tag considered to be a submit-button?
If so, how can I change this behavior?
If not, why are they doing it then?
Ok, the solution is that the button needs a type.
<button type="button" class="proceed_button" id="loan_information">Proceed</button>
<button type="button" class="cancel_button" id="loan_information">Cancel</button>
Like this, it won't submit the form anymore.
According to http://w3schools.com/html5/att_button_type.asp the default type is depending on the browser, so you should always specify the type.
I'm not sure that you want a button, maybe you want it to look like a button. Either way, refer to this post: rails 3: display link as button?
Once you have your button, you'll need to update your javascript to prevent anything from happening when it's clicked (assuming you have jquery). It's still nice to provide a real fallback for those dinosaurs without js, so assuming your proceed button submits for users without js, for those with js you'd do something like:
$('#proceed_button').click(function(e) { e.preventDefault(); // Show and hide your divs here });
Also note that in your posted code you should not have two buttons with the same id, your ids and classes look swapped.

OpenCart 1.5.3 IE cannot work payment method in checkout page

The "continue" button on the checkout page under delivery details doesn't work. But the ‘billing details’ continue button and all other always seems to work. When click on the button, the waiting GIF is loaded and nothing happen.. When I comment out below script then it seems to be fine in all browsers.
<script type="text/javascript">
<!--
$('.colorbox').colorbox({
width:640,
height:480
});
//-->
</script>
I want to show the Terms & Conditions in popup..I didn't get popup when I comment the above code and it shows in another page.
I had a similar problem with the tabs. I resolved the issue by placing the call in a document ready jquery container.(http://api.jquery.com/ready/)
The problem for me was that the JS in IE was trying to load before the element had rendered.

nyroModal v2: How to validate form opened in iframe?

I'm trying to figure out how to validate a form opened using nyroModal.
The page is being opened as below on click of a button:
$(function() {
$('.btnedit').click(function() {
$.nmManual('form_page.php);
});
});
On the form that opens up, I have a few fields that are mandatory and a cancel & submit button.
<a class="nyroModalClose button" href="#" id="btn_submit">Submit</a>
On clicking of the submit button, I want to make sure the mandatory fields have value. If no, an error message should be displayed & the modal window should not close.
I'm trying to use the jquery validation plugin, but without success. The modal window always closes irrespective of the validation scripts.
I haven't found much info regarding form validation in a modal window. Is this not a preferred approach?
Thanks in advance.
I'm not able to help you about the jquery validation plugin in a modal window, but I know that using the instruction $.nmManual in that way, the form will not be placed inside the iframe tag, and if I remember correctly the content of new page will be added without header and body tags, so in a word incorrectly. I guess this can produce no validation.
To successfully open an iframe you need to use filters as described here:
Open iframe manually in nyroModal?
I hope this can help you.

MVC Form - Clear ModelState on Back in Browser

I have searchbox in my web app.
I am curious how to clear ModelState when user hits back button. The page retains the 'text-input' from the search results page when the user hits back and goes to home page, which also has a search box.
Before Posting the ques did some initial research here.
I checked similar question on StackOverflow and saw that ModelState.clear() helps you clear he info. But when the user hits "back", the controller does not get called (obv!!) thereby Clear() does not get called.
So what is the best way to get around it.
One possible way would be to use javascript and clear the value when the page is loaded. For example with jQuery:
<script type="text/javascript">
$(function () {
$(':text').val('');
});
</script>