Jump to content

Module:Contact: Difference between revisions

From nUSA Wiki
No edit summary
No edit summary
 
Line 1: Line 1:
local p = {}
local p = {}


-- Function to render the form
 
function p.form(frame)
function p.form(frame)
     -- Get the username from the current user (if logged in)
      
     local username = mw.title.getCurrentTitle().text
     local username = mw.title.getCurrentTitle().text


     -- HTML for the contact form
      
     return mw.html.create('form')
     local formHtml = '<form action="/wiki/Contact" method="POST">' ..
        :attr('action', '/wiki/Contact')
         '<label for="subject">Subject:</label>' ..
        :attr('method', 'POST')
         '<input type="text" id="subject" name="subject" required><br>' ..
         :wikitext('<label for="subject">Subject:</label>')
         '<label for="message">Message:</label>' ..
         :wikitext('<input type="text" id="subject" name="subject" required><br>')
         '<textarea id="message" name="message" required></textarea><br>' ..
         :wikitext('<label for="message">Message:</label>')
         '<input type="hidden" name="username" value="' .. username .. '">' ..
         :wikitext('<textarea id="message" name="message" required></textarea><br>')
         '<button type="submit">Send</button>' ..
         :wikitext('<input type="hidden" name="username" value="' .. username .. '">')
         '</form>'
         :wikitext('<button type="submit">Send</button>')
 
         :wikitext('</form>')
   
        :getText()
    return formHtml
end
end


return p
return p

Latest revision as of 23:47, 3 January 2025

Documentation for this module may be created at Module:Contact/doc

local p = {}


function p.form(frame)
    
    local username = mw.title.getCurrentTitle().text

    
    local formHtml = '<form action="/wiki/Contact" method="POST">' ..
        '<label for="subject">Subject:</label>' ..
        '<input type="text" id="subject" name="subject" required><br>' ..
        '<label for="message">Message:</label>' ..
        '<textarea id="message" name="message" required></textarea><br>' ..
        '<input type="hidden" name="username" value="' .. username .. '">' ..
        '<button type="submit">Send</button>' ..
        '</form>'

    
    return formHtml
end

return p