NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: Mike Grigsby on April 18, 2008, 11:49:03 PM
-
Anyone know how I can simulate an inline delete link that will delete the highlighted record the way an inline Delete button would? A button uses some javascript onClick type stuff, where a link does not. I want the alert window to come up and ask Yes or No to delete, the way a button does. TIA.
-
Hi Mike,
If i understand your question correctly. Just use the appropriate javascript within a <a> tag.
Place this type of HTML inline:
<a href="#" onclick="document.ArticleTable_frm.action='ArticleTable?FromForm=ArticleUpdate'; document.ArticleTable_frm.target=''; dsb(ArticleTable_frm,deleteb_btn,'deleteb_btn','','');">Press here to delete</a>
All the stuff in the Onclick is the normal javascript NetTalk would generate for a delete button.
I know its lazy, but it works.
Regards
Bill
-
Hi Bill, I tried something similar to your suggestion, but still clicking on the link does nothing. I can't see any difference. I added a delete button side by side for comparison and the formatting looks the same to me. I'm perplexed.
Delete link (What I'm trying to do - This doesn't work):
<a href="#" onclick="document.BrowseRequisitions_frm.action='BrowseRequisitions?FromForm=UpdateRequisition'; document.BrowseRequisitions_frm.target=''; dsb(BrowseRequisitions_frm,deleteb_btn,'deleteb_btn','REQ__ID','10654');" >Del</a>
Button link (What's created when I use a button - this works):
<button type="button" name="deleteb_btn" id="deleteb_btn" value="Delete" class="SmallButton" onclick="document.BrowseRequisitions_frm.action='BrowseRequisitions?FromForm=UpdateRequisition'; document.BrowseRequisitions_frm.target=''; dsb(BrowseRequisitions_frm,deleteb_btn,'deleteb_btn','REQ__ID','10654');" title="Click here to Delete this record" >Delete</button>
-
Hi Mike,
Sorry about that, i have given you half the answer. I just looked at an old app that did something similar.... but not the delete action.
I have done this and tested it. Anyway here goes... (don't laugh Bruce!)
1. Create local variable in browse procedure DeleteLink STRING
2. At embed "Before Table Rows" insert this shocker
DeleteLink = '<a href="#"
onclick="var junk = document.createElement(''BUTTON'');
document.ContactBrowseFilter_frm.action=''ContactBrowseFilter?FromForm=ContactUpdate''; document.ContactBrowseFilter_frm.target='''';
dsb(ContactBrowseFilter_frm,junk,''deleteb_btn'',''CON__SysID'','''&CLIP(CON:SysID)&''');">
Delete</a>'
3. Place this field in the browser and turn Allow XTHML on that field.
In my example:
ContactBrowseFilter is a memory form that holds browse filters
ContactBrowse is the actual browse
ContactUpdate is the update page
CON__SysID is my unique field
A breif explaination
junk is an object just so i have the correct parameters for the dsb method, it does nothing
dsb does the submit and all the fancy work.
Regards
Bill
-
Sounds like a good approach to me Bill.
Hey Mike, why the preference for a link over a button? Should links for insert/change/delete (and the other buttons) be standard fare? What d y'all think?
Cheers
Bruce
-
Thanks Bruce, Yes, I think they should be standard fare. They're less "bulky" looking than buttons. I'm also trying to duplicate the look of Salesforce.com a bit because clients that use both products really like it.
Here are some other things that would help:
- Clone (or copy) link/button - Finally wrestled this one down.
- Drop down allowing user to select the loc:pagerows (how many records appear on the page).
- First, previous, next, and last should also allow for a link instead of buttons. (<<, <, >,>>)
- Ability to easy add delete, clone, and edit buttons from within a form.
- Ability to span browse header rows (right now they're <th></th> tags, and for Add, Insert, Delete, etc., it would be nice to add something like colspan="3" and allow the first heading, like "Action" to be used.
I need to build many of these anyway, but it would sure help to have them included.
-
Nice suggestions Mike. I like them.
Bruce, I'll put my hand up to have links as an option to switch over too. But buttons default.
Stu
-
Bill!
Awesome to see you on here. Nice posts, good to have your super brain helping people out :).
Stu
-
It should be fairly simply to turn "buttons" into "links" - I think. Because all the buttons are created with the CreateButton method, if we change the code that method generates, then hey presto all your buttons turn into links.
Of course this pre-supposes that one can make a link behave like a button - which is important because they behave usually in very different ways. I'll experiment a bit.
I like the header-spanning idea as well, I'm sure that's possible.
Cheers
Bruce