Javascript not trigering and alert function is working - javascript

I have Asp.net web application given by client with UI layer and its speaking with webservices. I am creating another asp.net web application copy pasted all the HTML,CSS and images other files.
ERROR :
I have Master page and child page.
In child pages I have lot of JavaScript for validating the text box.
Javascript like:
$(document).ready
rules and messages)
they getting form tag from master for binding.
But when I click the submit button, it's not validation the control
and I have placed alert box inside the JavaScript and its working.
Kindly help here...
alert box is working..and validation is not work in same JavaScript.
How to check the JavaScript is correctly bound with form tag?
Same problem appears in another set of master and Child page. I corrected the form tag. Like master page form tag should be in child page. It's validating properly.

alert outside the $(document).ready to check weather its coming inside the script also can you post the code for futhe

Related

Dynamics365 list view: where is custom javascript located?

I need to call custom javascript from custom dialog on the list view.
On list view user click on button (on ribbon). Button starts javascript. Custom javascript create the div dialog with some choices. Every choice has onclick javascript action. But where is my custom javascript code?
In the similar scenario, on form view I can find this cusom javascript as
document.getElementById("customScriptsFrame").contentWindow.<my_func>()
But where is similar location for custom javascript in list view?
If I understand your question,
You already have your html div dialog created in a webresource.
Do you already have Ribbon button in place? and Javascript behind it?
If not this is what you need.
There is an plugin in XRMToolBox called Ribbon Workbench. Use it, and you can add new button on list view.
On that button command you can add Javascript and function which will be called.
Now inside your javascript you can call your html code or you can directly call another webresource as well.
Right question was "where is stored the custom javascript on listview page". And answer is simple: in iframe named "contentIFrame0".
So, right onclick value is "document.getElementById('contentIFrame0').contentWindow.my_func();".

LumX button (lx-button) won't work

I'm writing a web application using HTML, Javascript and AngularJS. For my UI I'm experimenting with LumX. I tried Angular Material but it was way too slow on IE.
However, I'm having difficulty simply submitting a form using LumX. The reason is I can't get the button to work. The LumX site clearly states:
"lx-button is a directive that create a link element if you specify a href or ng-href attribute
Otherwise, it creates a button element."
Here's what I have:
<lx-button id="add_button">Button</lx-button>
Then, in my functions.js file I have:
document.getElementById('add_button').addEventListener('click', add);
The add( ) function simply adds that item to a list. The function is working, because the program works as intended with a normal button. It's just when I use the lx-button tag that it stops working.
Thanks.

Hash routing at single page with changing content

I have two pages and I need to make one using html and javascript
F.E. First page is a form and second page is a table to work with. So, after user submit the form, page have to update without refreshing. Form have to disappear, and table have to appear instead of it. How can I do it without PHP or frameworks like AngularJS and with #blabla routing or something HTML and JS only?

Adding onsubmit to a form via javascript

How would you go about inserting an OnSubmit attribute to a form via Javascript only?
I'm pretty new to javascript so if you're able to provide detailed example code, that would be most helpful!
Here's the situation: I'm using a hosted signup page through Chargify (a payments platform) in order to process credit cards for my app, and then send the user back to my own thank you/confirmation page.
Tracking the entire funnel through google analytics is proving quite elusive due to changing domains (my domain -> Chargify.com -> my domain), since the credit card page is hosted by Chargify on their own domain.
I'm getting close: I've been able to get cross-domain tracking working (chargify.com page gets logged in Google Analytics), and can link from my domain to chargify by adding the following onclick attribute to my signup link:
onclick="_gaq.push(['_link', 'http://my-domain.chargify.com/subscriptions/new']); return false;"
However, I cannot do the same thing on the way back (Chargify -> Confirmation page) because I do not have access to the Chargify hosted payment page code, and because the user is taken to my confirmation page via a form submission, not a normal link.
Partial Solutions (need your help to finish this up):
Chargify allows several options for their hosted pages, one of them being to add custom javascript that gets inserted right before the </body> tag in a <script> tag.
I found some resources in the Google Analytics documentation on how to link pages, and adding the following to the Chargify form tag might work: onsubmit="_gaq.push(['_linkByPost', this]);"
(source: https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiDomainDirectory#_gat.GA_Tracker_._linkByPost)
The form tag does not currently have an onsubmit attribute, it's just this: <form action="/my_product/subscriptions" class="new_submission" id="hosted_payment_form" method="post">
Is there a way to use Javascript to simply append this attribute to the form tag? If you'd be able to provide a detailed example of what code I should insert inside of the <script> tag, that would be extremely appreciated.
window.onload = function() {
var form = document.getElementById('hosted_payment_form');
form.onsubmit = function() {
_gaq.push(['_linkByPost', this]);
}
}
I believe the above example is similar to what you need. We use document.getElementById to grab a reference to your form. Then set the onsubmit property to the code you want executed before the form is submitted. Remember to put this inside the window onload event if this JavaScript is executed before the page is rendered to ensure the form is built.

How to link the popup JavaScript and popup aspx page while implementing Ribbon toolbar button in Tridion?

I am implementing a ribbon tool bar button for component view.
When I click in the RTF field the button will be enabled. When I click on the button it will open a aspx page. When the aspx page is opened the corresponding JavaScript should initialize by default. But in my case it is not happening.
I have given common names to the JavaScript and aspx page. Please suggest how to debug this problem and get a solution.
Are you saying that your JavaScript file doesn't get included at all?
Or that the "initialize" method isn't getting called?
If it's the former, you should look at your dependencies. Normally you would have a group in your Editor configuration file which includes the .js file and optionally a .css file as well. You would then include a dependency on this group in your .aspx.cs file, by including a ControlResources attribute (passing in the name of the group).
If the problem is that your "initialize" method isn't being called, you should check if you are registering the view (e.g. calling $display.registerView(FullNameOfYourClassIncludingNamespce) at the bottom of your JavaScript file)

Categories