How to click on a value in the table - javascript

I want top click a value in the dynamic table where my values location can be anywhere depends on the login user permission. so I can't go with the index.
I need to search that value by text and need to click on it.
When I am doing it through IDE, it's doing type function will is not resolving my problem, when I am converting type methoc into click then it's going with .
Plz help me on this.

Perhaps, you have possibility to use javascript library like JQuery, for instance, and get your table's cell using its selectors. I think it will be the simple way.

Related

Multiple Key Value Query Search Input Box

I'm not quite sure exactly what to search for or where exactly to start, but I'm trying to see if it's possible to have a customized search box for multiple GET queries simply using jQuery, JS, HTML and CSS.
The user would first type in something which will prompt the red box to show (key) and it would autofill with a listed default given the first few characters they typed. Then upon pressing enter or tab, they would be allowed to fill in the answer gray box (value). Then after, they can either choose to submit or put in another key / value.
Is there a jQuery library that already has this implemented, and is this even possible? I thought about putting input boxes inside the input search box and using jQuery to hide and show them depending on what they type, but is that the best way?
I'd like to do this without comprehensive framework / library like Angular and React.
Thanks in advance!
You must handle it with one of JavaScript freamworks like Vue.js, React.js or Angular.js

local visible text search on current web page

I need to do a local search visible text on a single simple html page. Users can simply use Ctrl+F to do that, but I would like to add a search box on the page to do the search instead. I thought of a couple ways to do this:
1- By forcing the browser's Find tool when a button on the page is clicked.
2- By a javascript/Jquery plugin that do LOCAL search on the current page.
I searched for both solutions but was not able to find anything useful. Does anyone here have any suggestions?
You can give a common class name to the tags that contains the display text and perform a search based on that class name. I had attached a link for your reference. you can make use of that funtion and call that function from a button click.
Generic Search in HTML Page

Javascript: Getting and saving text selection ranges in a database

I'm building a gramma-checker system for a client, where users can add comments/suggestions to a given text. When a user selects some text, a button appear to create a comment/suggestion to that given text selection. My problem comes when I want to save the text selection range in a database, along with the comment/suggestion.
I'm currently trying to solve the problem by using Rangy (http://rangy.googlecode.com/).
These are the ideas I'v tried so far:
Using the rangy serializer to serialize the range. The problem with
this approach is that the DOM is changing each time a new
comment/suggestion is added, and therfore not allowing for a
successful deserialization.
Using the rangy selection wrapper and save that directly in the
database, but like the idea above, the target elements content is
changing with each comment/suggestion, which again makes the approach
not work as intended.
Any suggestions to how I could solve this problem would be appriciated.
I haven't used rangy. But here is one way I would approach it.
Get a selected text from a element (tutorial here)
Then add a wrapper span with a specific id to it. (You might want to fetch a unique id from your server)
Then show a form to enter comments.
On Submit, send the span id and comment to server and store it in database.
When re rendering you can easily assign a class to this span to mark it and show comments on hover using css.
This will give you a system like google document where you can comment on text.
Let me know if that helps or you need more explanation on how to accomplish individual steps.
Advantage of this is you dont need to send the selected text back to server or worry about serializing. Just the id of span you wrapped it in.

Hide/Disable Edit button based on column's Values in Sharepoint 2010

I have a column that has 2 Categories, Done and Pending. I would like to Hide/Disable edit button once the user selects an item and if that item has a Status column of "Pending".
I would like to know how can this be done, whether in visual studio 2010 or ECMA Scripts.
I know this question is old but if someone still needs the answer:
Create a custom action in visual studio like this:
https://msdn.microsoft.com/en-us/library/office/ff408060(v=office.14).aspx
This hides the button you want, now you can set a condition via enabledscript parameter to choose in which case the button should be hidden:
Just add this code after </CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler
Command="HideEditRibbon"
CommandAction="javascript:return true;" EnabledScript="javascript:checkIfNeedsToBeHidden();" />
</CommandUIHandlers>
<CustomAction Id="yourJsReference" Location="ScriptLink" ScriptSrc="yourJsFile.js"></CustomAction>
If you need this in List-Ribbon, Edit and DisplayForm, you need to make 3 Custom Actions and change the Location-Part and maybe your js-code.
If you want to use an out of the box edit form then you're not going to do this with server side code; you'd need an entirely custom edit form to do that.
This means using Javascript on the edit page, which is fragile, and doesn't prevent users from saving the data if they know what they're doing.
The input field for every column will have a 'title' attribute with the column name. JQuery can find the element with title='column name' rather easily, so that's how you'll know if you need to hide the save button. The save button isn't quite as easy to get to. You could try getting the input with type=button and value=save.
If it's important to have actual security around this, so that no matter what someone can't edit an item in this state then you can use an event receiver on the ItemUpdating event. Just check the properties of the item and use the properties.Cancel = true; (or something like that) so that even if they disable your JavaScript and save the event anyway, it won't get saved. If you need help adding an event receiver or getting it working just ask.
Edit: In your comment that you say you just want to prevent access to the edit form entirely under certain conditions. For that, I'd make a new webpart/user control and add it to the edit page. In that section you can fetch the appropriate item (the ID of the item will be a query parameter) and see if the page should be 'viewable'. If not, then you can redirect to another page.
Another addition to the above would be attempting to edit the list view such that there is no edit link for certain items. This would be substantially harder, and I doubt it would even be possible (practically) with out of the box webparts. You would need to have an entirely custom list view page in order to control which items have links to an edit page. (Others feel free to correct me here.)

JQuery advice needed

I need a simple form with radio buttons or pull downs, that returns a different message and link depending on the answer.
I don't want to save the data, but just to display based on the answer.
Is that we can do in JQuery..?
If anyone knows, please explain..
the code example on jquery's website for the change function is what you want, it registers a change handler, checks the value of the selected item, then changes the content of a div depending on your selection.

Categories