Call function onClick ASP.NET Core - asp.net-mvc

I have a dropdown menu that show a list of files saved on disk:
It works fine but when you think about it, I have to load all the links/docs every time someone goes on the page.
What I would like to do is to have some sort of onClick function so that it would load / get the files only when asked so when I click on the 'a' tag.
I tried to add an onclick="nameOfmyFunction" but that does not work.
Could you give me some tips to achieve this? Or is it even possible?
Edit:
That is not it. I want to load al my files when I click on the "Consulter les conventions" which is the first <a class="dropdown" data-toggle="dropdown"> tag.
So I tried something like this :
If the user click on the "conculter les conventions" then I load my files and create my dropdown menu else do not create the dropdown menu.
But I get the error that (when I try it) the function is not defined.

Related

Print to specific printer using VBScript?

I'm trying to have users fill out an HTA form, submit it (which will CC them a copy) and have it automatically print to a specific network computer that will only be used for this purpose.
I was able to get the form to basically print the window by using the following code:
<input style="margin-right: 5px;" type="button" name="Print" value="Print" Onclick="print()">
However, that just brings up the print dialog box that makes me choose a printer, and people won't be able to select this printer I need to use.
I've looked and tried a few things, but this has been the only thing that has worked so far. I don't want users to be able to change anything (number of copies, etc.). I just want it to print their input once they click "order".
Thanks!!
-EDIT-
I tried using "window.print()" as the OnClick event of the submit button, which would work, but it just brings up the print dialogue box for users to choose a printer. I need it to just automatically print it out.

jquery mobile changePage not working if called from an ajax loaded page

situation:
form1.html has a button
clicking that button calls $.mobile.changePage('../site3/form2.html');
no problem here. all is as expected and the page is loaded. let's call that form2.html
form2.html has 2 sections:
(1) #SiteForm and
(2) #SiteSearched
clicking a button on #SiteForm should call $.mobile.changePage('../site3/form2.html#SiteSearched');
now here's the weird part.
if I load the page form2.html directly and press the button, it works and I see #SiteSearched JQM page.
but, if I start from form1.html, click the button to get to form2.html#SiteForm, then click the button, everything in the attached function executes, except the line calling $.mobile.changePage('../site3/form2.html#SiteSearched');
I know that part is loaded by AJAX by wouldn't the changePage command work?
(note: Form1 may have data filled into the form that I don't want to lose. Form2.html was meant to do a search and throw back the result to Form1 somehow, which is why I am doing things this way.)
You should read official jQuery Mobile documentation before posting here, everything is explained there, but let me give you a short explanation.
jQuery Mobile has two template solutions, one is multi page and second one is multi html. You already know that because you are mixing them. But, what you don't know is (from the perspective of AJAX page handling):
Only first HTML page is fully loaded into the DOM, everything is loaded, including the HEAD content. So if initial HTML page has several data-role="page" <div> containers, every one will load into the DOM.
But, every subsequent page is loaded only partially. Basically if you second, third ... page has more then one data-role="page" div containers only first one will load into the <DOM>. jQuery Mobile will discard everything else.
So in your case, if form2.html has:
(1) #SiteForm and
(2) #SiteSearched
jQuery Mobile will load only #SiteForm, #SiteSearched will get discarded.
Basically this line will not work:
$.mobile.changePage('../site3/form2.html#SiteSearched');
You can't nit pick specific pages in subsequent pages, as I told you. You can only use this:
$.mobile.changePage('../site3/form2.html');
And jQuery Mobile will show you first data-role="page" occurrence inside form2.html page.
Read more about this here and here.

jquery ui tabs multiple calls to tabs()

I have a page where I put my tab content into a div.
This work fine and I can see the tabs.
Later, an event occurs (like selecting a combo box value) and I want to change to another set of tab.
I basically did:
('#divId').empty();
someData.appendTo("#divId");
$("#divId").tabs();
Here is the problem, this 2nd call show me a list:
. tabName1
. tabName2
..... etc
Any idea what's going on, seems like the call to .tabs() work only once when I first load the page.
Thanks.
Check the value of someData, it might contain invalid html that cannot handled when you call the jquery tabs() method again.
One way to do it is:
console.log(someData);
Then if you're using chrome, hit F12 then click on "Console".
$("#detailUL").append("<li><a href='#tabs3-"+id+"'>Desc No "+m+"</a></li>"); // desc
$("#details").append("<div id='tabs3-"+id+"' class='it_detail'>"+copy+"</div>"); // detail
$("#detailPanel").tabs("refresh");

JQuery Mobile & passing variables in links via the querystring - but the querystring doesn't refresh

I am doing a PhoneGap app with JQuery Mobile and I have two pages, one that has a dynamic list of pages and one that has a form to either edit or create a page. These are in a single html file.
Tapping on a list item passes ?action=edit and tapping the "Add" button I have, passes ?action=add querystrings.
Here is a jsfiddle to visualize the pages
NOTE: The example doesn't act quite the same as the live code.
I am running my app on an Android phone and if I do these actions, the correct querysting is observed in the alert box: -
Click the add button on list page
Click back on the form page
Click the an edit list item link on list page
However, if I do it the other why around (click edit first, then the add button) clicking the add button never shows the add querystring in the alert box
(the jsfiddle example always locks the first clicked link's querystring, which is even worse than the live code!)
The problem here is that you're using a multiple template to do this. If you were using this as separate pages, this would work as normal. As a multiple app, the best way to handle this would be to make a link trigger the setting of some global variable that keeps track of the current state of the app.
Make the edit links like this
Page 15
Then make the script something like this:
var editingId = 0
function editPage(id){
editingId = id;
$.mobile.changePage("#editingPage");
});
$("div#editingPage").live("pageshow", function(){
loadDataForPage(editingId);
});

How to redirect user back to list item form when list item is edited in SharePoint 2007?

Out of the box, I've noticed the following user experience in SharePoint 2007:
User navigates to a list.
User opens list item for display.
User selects "Edit Item" link.
User changes the list item, presses Submit.
User is redirected back to list.
Is it possible to change the last step so the user is redirected back to the list item display form? If so, how is it done?
You can create a custom form by with SharePoint Designer then customize the OK Button to save and redirect to the display view.
To create custom edit form using SharePoint Designer here is a full instructions on how to do thi http://office.microsoft.com/en-ca/sharepoint-designer-help/create-a-custom-list-form-HA010119111.aspx
Once you done this then find this line on the source code of you new page
<xsl:decimal-format NaN=""/>
<xsl:param name="dvt_apos">'</xsl:param>
<xsl:variable name="dvt_1_automode">0</xsl:variable>
and append this line below
<xsl:param name="ListItemId">0</xsl:param>
"this will make the id of the current item accessible by the button"
replace both of your OK buttons
<SharePoint:SaveButton runat="server" ControlMode="Edit" id="savebutton1"/>
whit this one
<input type="button" value="OK" name="btnSave" onclick="javascript: {ddwrt:GenFireServerEvent(concat('__commit;__redirect={dispform.aspx?id=',$ListItemId,'}'))}" />
Save and test :).
You don't necessarily have to replace your OK buttons for this one you can also add this extra button and instead of calling it OK call it something like Save and display and let the user decide what to do (just and idea)
Hope this helps!

Resources