How do you create a category (or select an existing one) from a field value on a Page Form in MediaWiki? - mediawiki

I created a form to allow users to input data about scientific topics, references and categories in an organized manner. Problem is, I am unable to automatically categorize the page (by either creating a new category or using an existing one) when a user fills the form with the appropriate category information.
Here is the template page from my Mediawiki site:
<noinclude>
{{#template_params:Summary (label=Topic Summary (In point form, as a numbered list. Include references between <ref></ref> tags.))|User_Category}}
</noinclude><includeonly>
{{#template_display:_format=sections}}
[[Category:Summary Article]]
[[Category:{{#arraymap:|,|##||}}]]
</includeonly>
Here's my form code:
<noinclude>
This is the "Summary Article" form.
To create a page with this form, enter the page name below;
if a page with that name already exists, you will be sent to a form to edit that page.
{{#forminput:form=Summary Article}}
</noinclude><includeonly>
<div id="wikiPreview" style="display: none; padding-bottom: 25px; margin-bottom: 25px; border-bottom: 1px solid #AAAAAA;"></div>
=Summary=
{{{section|Summary|level=1}}}
==Category==
{{{field|User_Category|level=2}}}
</includeonly>
I attempted to assign the field value to the category variable User_Category in order to create a category in the page, but was unsuccessful. Any assistance would be greatly appreciated.

First, you should specify the input type of your field, in your case, tokens should be appropriate.
Then tell the field to take values from the category list, you can achieve this with values from namespace attribute.
{{{field|User_Category|input type=tokens|values from namespace=Category}}}
Second, your template has no reference to the field name User_Category. This should be the arraymap data :
{{#arraymap:{{{User_Category}}}||##| [[Category:##]] }}

I eventually found the solution, which is similar to the one above - but does not cause errors. Here's the template:
<noinclude>
{{#template_params:Summary|Categories}}
{{#template_display:_format=sections}}
</noinclude><includeonly>
[[Category:Summary Article]]
{{#arraymap:{{{Categories|}}}|,|x|[[Category:x]]|\s}}
</includeonly>
Here's the form:
<noinclude>
This is the "Summary Article" form.
To create a page with this form, enter the page name below;
if a page with that name already exists, you will be sent to a form to edit that page.
{{#forminput:form=Summary Article}}
</noinclude><includeonly>
<div id="wikiPreview" style="display: none; padding-bottom: 25px; margin-bottom: 25px; border-bottom: 1px solid #AAAAAA;"></div>
{{{for template|Summary Article}}}
==Summary==
{{{section|Summary|mandatory|rows=20}}}
==Category==
{{{field|Categories|input type=tokens|values from namespace=Category}}}
</includeonly>

Related

Peoplesoft html area value not returned

I have a basic text input statement in a PeopleSoft html area on a custom page:
<input type="text" id="drivers" name="drivers" style="position:relative; width: 13em; left:3pt; top:3pt;color: #000000; font-family:Arial, sans-serif; font-weight: bold; font-size: 10pt; background-color: #FAFAD2;" size="13" placeholder="Example:N1234567" required="" maxlength="13" value="R291992929399">
The value R291992929399 shows up on the page as it's supposed to.
When submitting the value without changing the initial value of R291992929399, peoplecode returns a blank or null value. I'm using the "%Request.GetParameter("drivers")" to access the value in the html area within Peoplecode.
The strange part is, if a messagebox is thrown on the page (checks the value to make sure it's not null, then produces an error message stating it can't be blank or null), the page is refreshed with the same value as before. If I submit the value a second time, after clearing the error message, Peoplecode picks up the value R291992929399.
The only items on the peoplesoft page are: buttons to validate/save the page, employee id, company edit boxes, secondary page, and the html area.
Why does peoplecode not pickup the value when the page first loads?
The PeopleCode page backing data model is initialized on the app server. HTML is generated to match and display that model. When it is first generated, the value of that html area is just a string; no data is stored for the input field. When you do a partial post-back for a message box, the JavaScript post back send the current state of all inputs to the server therefore capturing the value.
The easiest way to get around this is use a derived record/field, and bind the field value into the HTML, that way that record is the backing model for the HTML area and will have the value for you to use in PeopleCode.
Use a HTML object in App designer, get the HTML Text and use %bind(:1) in the HTML, use PAGERRECORD.HTML = GetHTMLText(HTML.MY_HTML, &rec.field.value);
Does this help?

Selenium IDE- Clicking on a dynamic id

I'm using the Selenium IDE and trying to get it to click on a specific search bar in a page, but the id of the search bar changes every time the page is refreshed. There are no other unique things I can use for contains().
<div class="ace_content" id="id-46319949-a1be-4d53-a2a8-fa644b37485b" style="margin-top: 0px; width: 764px; height: 60px; margin-left: 0px;">
This is the HTML. Is there any other way of finding the search bar?
As per the selenium docs, you have various selectors to choose from, other than id.
You can select on the class which appears to be static:
driver.find_elements_by_class_name('ace_content')
If multiple ace_content divs exist on the page, you can select the nth occurence of the div by just getting the n-1 index of the list returned by find_elements_by_class_name.
Resolved. I used this
//*[#class='ace_content']
to identify this xpath because ace_content was unique.

Some part of my Django form should change based on TypedChoiceField list selection

I am new to Django. I have a requirement where in based on the TypedChoiceField list selection some part of the form should be changed. Meaning for a particular selection I need some fields to be displayed on the webpage and for other selection I need some other fields to be displayed on the webpage.
If there is already a similar page existing, please point me to that page, it will help me a lot.
What I would do is set up a javascript static file (here's a tutorial) that hides and shows elements using the select method.
For example, if you had categories that each needed a different set of fields, you could put all your categories into a <select> element and then using some simple JS, display the desired fields:
$("#select_object").change(function () {
toggleFields();
});
In that case, #select_object would be that <select> element. Whenever it changes (the user selects something) it shows the fields you want.

How can I hide the HTML in a gravity form field from appearing in te confirmation message?

Basically I am using a radio button field and have added HTML in the field itself to link and a preview plugin class like so
Field: Sedan, 3-passenger View
And this works fine except when the form gives confirmation message using the corresponding field's merge tag {vehicle you would like} it shows the entry and all the HTML as a string as well, which obviously is a problem. How can I fix this issue and have the confirmation treat the html as such? Do I have to add all of this html as a class instead and apply it to the unique entry css instead of inline or is there some way to mess with the merge tags or with minimal css changes to the confirmation message classes?
The stuff in the confirmation field in the form UI (using inline styles to test for now, I know its not the best way but either way doesn't really solve my problem):
<p style="text-align:center;"><strong style="font-size:16px;"> Thank you!!!</strong>
We will send you an <strong style="color:#8E0F0F;">Email Quote</strong> within the next <strong style="color:#8E0F0F;">30 minutes.</strong>*
*Subject to Driver Availability.
<strong style="color:#8E0F0F;">Important Warning: When we send you an Email Quote, it might end up in your SPAM/JUNK EMAIL folder, so please double check that folder.</strong></p>
<strong>Submitted:</strong>{date_mdy}
<strong>Status:</strong> Waiting to be accepted by a Service Provider.
<strong>Pick Up:</strong> On{Pick-Up On::7}, at {At::8} at
{Address (Street Address):9.1} {Address (City):9.3}
<strong>Drop Off:</strong> {Drop-Off Airport/Cruise Port:10}
<strong>Passenger or group name:</strong> {Passenger/Group Name:15}
<strong>Number of Passengers:</strong> {Number of People in the Group:16}
<strong>Contact Person:</strong>{Contact Person's Name:17}
<strong>Quote will be emailed to:</strong>{Contact Person's Email:18}
<strong>Rate:</strong> {What Type of Vehicle Would You Like?:6} Quote to be Provided. <strong>15% Online Discount Active!</strong>
Extra question on the same form, is there any way to attach a timestamp to the {date_mdy} merge tag so it actually includes the time of submission in the confirmation and not just the date? Obviously the hook exists since entry time is shown in the WP backend but I don't know how to go about getting it to work here. Thank you for any replies, this car reservation form has been a headache.

Keeping Form id like numerical value in the HTML Dom Element

In my application i want to keep my Form id in the Dom element So that on click of my Dom element, i get to know the Form id and make use of that for further purpose.
For eg:
my app has a list of form names generated like
Contact Form
Personal Form
I want to save my form id that is 1 somewhere in the Dom element a.
And onclick of that link i want to make use of it for further things . How can i do .. Where can i save my Form id in the Dom element.Please suggest me..
Edit:
In my application by using JQuery, i am generating list of Form names by fetching it from by MYSQL database using CakePHP framework.
eg:
$('#entryManager').click(function(){
$("<p class='title2'>Forms</p>").appendTo("#fb_contentarea_col1top");
$("<ul class='formfield'>").appendTo("#fb_contentarea_col1down");
<?php foreach ($Forms as $r): ?>
$("<li><a id=Form'<?=$r['Form']['id'];?>' href='/FormBuilder/index.php/main/entryManager'><?=$r['Form']['name']?></a></li>").appendTo("#fb_contentarea_col1down .formfield");
<?php endforeach; ?>
return false;
});//entry Manager Click
On click of Entry manager the Form names are listed .
And now i want to use some function like onclick of each Form name i want to retrieve the Entries filled by invitees from the database.For this i want the FOrm id each Form name to store it somewhere in the DOm element so that i can get that value (form id) and send it to my ajax request to fetch the entries filled..How can i do so???
Don't use purely numeric id's, it's best if they start with a letter, but essentially you can can have...
<form id="form1"...>
And then store the information in your anchor like this...
<a rel="form1">Click...
Then you can pull the "rel" tag out and use it to reference form1.
This is technically stretching the purpose of the rel tag, but does work.
document.forms is an array that contains all of your forms and you can do something like this:
document.forms['myFormId'] and you would get the form of that ID. But yet I am not getting what you are trying to achieve. May be if you elaborate on it further then I can guide you better on this.